Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    leggere dati da un foglio excel

    Ciao Ragazzi vorrei leggere dei dati da un folgio excel ho trovato questo script

    <%
    Xls = server.MapPath(".") & "test.xls"
    dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Xls & "; Extended Properties=""Excel 8.0;HDR=Yes;"""
    Set con = Server.CreateObject("ADODB.Connection")
    con.Open dsn
    StrSQL = "SELECT * FROM [Foglio1$]"
    Set RS = Server.CreateObject("ADODB.RecordSet")
    RS.Open strSQL, con

    if not rs.eof then
    Set rss = Server.CreateObject("ADODB.RecordSet")

    do until rs.eof

    response.write(RS("A")) & "
    "
    response.write(RS("A"))

    rs.movenext
    loop
    rs.close




    Set RS = Nothing
    response.Write("fatto")

    else
    response.Write("non ci sono dati")
    end if
    %>


    le mie domande sono:

    1) il nome della colonna è quello preimpostato di excel quindi A B C D etc... oppure è il nome della cella A1 B2 C3 D4 etc...

    2) ho provato a caricare un file e mi restituisce questo errore :


    Microsoft JET Database Engine error '80004005'
    The Microsoft Jet database engine cannot open the file ''. It is already opened exclusively by another user, or you need permission to view its data.
    /test.asp, line 5

    c'e da installare sul server qualche componente o dns ? se si quale

    Grazie



  2. #2
    Utente di HTML.it L'avatar di luck
    Registrato dal
    Oct 2004
    Messaggi
    550
    ...scusa, ma non è che tieni aperto in locale il foglio xls mentre testi lo script?

    e comunque per sicurezza chiudi anche la connessione e libera la variabile:

    <%
    con.close
    set con = nothing
    %>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.