asp 读取excel 的程序问题,高手请指点
Dim Driver, DBPath
Driver="Driver={Microsoft Excel Driver (*.xls)};"
DBPath="DBQ="&"e:\test.xls"
Set connxls2=Getconnection(Driver&"ReadOnly=0;"&DBPath)
set rstschema2=connxls2.openschema(20)
if not rstSchema2.EOF then
xlssheetname=rstSchema2(2)
xlssheetname=right(xlssheetname,len(xlssheetname)-1)
xlssheetname=left(xlssheetname,len(xlssheetname)-2)
end if
set connxls2=nothing
if xlssheetname=empty then
response.write("这个excel文件没有任何表。")
response.end
end if
Function Getconnection( Param )
Dim connxls2
Set Getconnection=Nothing
Set connxls2=Server.CreateObject("ADODB.connection")
If Err.Number <> 0 Then Exit Function
Response.Write Param
'Response.End
connxls2.Open Param
If Err.Number <> 0 Then Exit Function
Set Getconnection=connxls2
End Function
结果报错了,错误报告如下:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Excel Driver]常见错误 不能打开注册表关键字 'Temporary (volatile) Jet DSN for process 0xc9c Thread 0xe30 DBC 0x1156374 Excel'。
/unicomweb/test_xsl.asp, 第 28 行