Iis 7 ADODB连接在Windows 7上失败,但在XP上失败
我有一个简单的程序来测试使用ADODB打开excel文件的连接。 这是ASP的经典使用VBScript。 代码如下:Iis 7 ADODB连接在Windows 7上失败,但在XP上失败,iis-7,asp-classic,ado,windows-7-x64,Iis 7,Asp Classic,Ado,Windows 7 X64,我有一个简单的程序来测试使用ADODB打开excel文件的连接。 这是ASP的经典使用VBScript。 代码如下: <%@ Language="VBScript" %> <% Response.buffer = true %> <html> <body> <% 'Name of the excel file exceldb="AW_Test.xls" excel_file_name=Server.MapPath(exceldb) resp
<%@ Language="VBScript" %>
<% Response.buffer = true %>
<html>
<body>
<%
'Name of the excel file
exceldb="AW_Test.xls"
excel_file_name=Server.MapPath(exceldb)
response.write(excel_file_name)
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790; DBQ=" &excel_file_name & ";"
cn.Close
Set cn=Nothing
Response.Write("All is good in the world...")
%>
</body>
</html>
但是,在此配置下的同一台机器上:
- XP模式下的虚拟PC
- IIS 6
- 根目录中的文件
- 在本地主机上运行[http://localhost/adotest.asp]
C:\inetpub\wwwroot\AW_Test.xls
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Excel Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.
/adotest2.asp, line 13
c:\inetpub\wwwroot\AW_Test.xls
All is good in the world...
我已经验证/尝试过的事情:
- 已验证权限(注意这是根目录)
- 试着用喷气发动机代替
cn.Open 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\WWWRoot\AW_Test.xls;Extended Properties="Excel 8.0;HDR=No"'
C:\inetpub\wwwroot\AW_Test.xls
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/adotest3.asp, line 13
- 已验证所有以32位模式运行的应用程序池
- 已验证的驱动程序存在于数据源的SYSWOW端
cn.Open "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" &excel_file_name & ";"
它应该可以工作。请检查以下内容中接受的答案:。