0
我希望能夠在讀取和寫入數據的Excel文件經典ASP
C:\Inetpub\wwwroot\excel\excel.xls
我用下面的代碼試圖讀取和寫入使用經典ASP存儲在我的本地機器上的Excel文件:
<%
' Set Connection Params
Set oConn = Server.CreateObject("ADODB.connection")
oConn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;" &_
"DBQ=c:\Inetpub\wwwroot\excel\excel.xls;" &_
"DefaultDir = C:\Inetpub\wwwroot\excel\"
Set RS=Server.CreateObject("ADODB.recordset")
' Write the SQL Query
RS.open "SELECT * FROM my_range", oConn
do until RS.EOF
Response.Write (RS("NAME") & " -- " & RS("EMAIL") & "")
RS.movenext
Loop
'Close the recordset/connection
RS.Close
oConn.Close
Set RS = Nothing
%>
這是我從here
了,但我得到了以下錯誤:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/ASP/excel.asp, line 4
我只是一個ASP初學者,不知道該怎麼做。請幫幫忙!