ado open xlsx文件经典asp

时间:2011-12-12 16:37:14

标签: asp-classic ado xlsx

我正在尝试使用经典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 

1 个答案:

答案 0 :(得分: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

A few connection string examples for the Excel 12

相关问题