Ciao a Tutti,
ho il seguente codice della mia pagina excel.asp che funziona bene.
In questa pagina leggo i dati da un foglio Excel i quali sono contenuti in 2 fogli diversi.
Ho postato il codice per vedere se si puo' abbellire / Migliorare ...
<%@ Language=VBScript %>
<%
Option Explicit
Dim Conn, str, SQL, SQL2, RS, RS2
'
Set Conn = Server.CreateObject("ADODB.Connection")
str = "DRIVER={Microsoft Excel Driver (*.xls)}; "
str = str & "DBQ=" & Server.MapPath("../fpdb/cons.xls") & "; ReadOnly=False;"
Conn.Open str
'
Set RS = Server.CreateObject("ADODB.Recordset")
Set RS2 = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM [esterno$]"
SQL2 = "SELECT * FROM [interno$]"
'
RS.Open SQL, Conn
RS2.Open SQL2, Conn
RS.movefirst
RS2.movefirst
'
Do While NOT RS.EOF
response.Write RS(1) & " " & FormatNumber(Round(RS(16)),0) & "
"
RS.movenext
Loop
'
response.write "
"
Do While NOT RS2.EOF
response.Write RS2(1) & " " & FormatNumber(Round(RS2(21)),0) & "
"
RS2.movenext
Loop
'
RS.close
RS2.close
set RS = nothing
set RS2 = nothing
Conn.close
set Conn = nothing
'
%>
Ad esempio: e' possibile mettere i "Set" su di una stessa riga,
Rs.close e RS2.close su una stessa riga, ecc...
Grazie in anticipo !!!

Rispondi quotando
