0

我正在尝试使用经典的 ASP 和 ADO 打开一个 xlsx 文件

连接字符串如下。但它会产生错误。我究竟做错了什么?

Driver=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Derek Cohen\Documents\!!websites\demographix\surveys\AKGW-YHSN\pu_VTGDVVJZ_56_4088906840162.xlsx;Extended Properties=Excel 12.0;HDR=Yes;IMEX=1;

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name too long 
4

1 回答 1

0

Microsoft.ACE.OLEDB.12.0 是提供程序,因此您的连接字符串无效。尝试以下操作:

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Provider = "Microsoft.ACE.OLEDB.12.0"
objConn.ConnectionString = "Data Source=C:\Users\Derek Cohen\Documents\!!websites\demographix\surveys\AKGW-YHSN\pu_VTGDVVJZ_56_4088906840162.xlsx;Extended Properties=""Excel 12.0;HDR=Yes;IMEX=1;"""
objConn.Open

Excel 12 的一些连接字符串示例

于 2011-12-14T13:54:03.243 回答