使用驱动 xlsx vb6 读取 excel
Reading excel with the driver xlsx vb6
我在一个星期内遇到了一个问题,但我找不到解决方案。我正在尝试在 vb6 上读取 xlsx 中的文件作为 asp 经典的一个组件。
我无法解决的第一个问题是这个
Dim cn As New ADODB.Connection
Dim provider As String
provider = "Driver={Microsoft Excel Driver (*.xlsx)};DBQ=" & nomArq & ";"
Set cn = CreateObject("ADODB.Connection")
cn.Open provider
我在这方面遇到的错误是
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
第二次尝试是这样
Dim cn As New ADODB.Connection
'Dim provider As String
With cn
.provider = "Microsoft.ACE.OLEDB.12.0;Data Source=" & nomArq & ";" & ";Extended Properties=\""Excel 8.0;HDR=Yes\;"""
.Open
End With
错误是
"Format of the initialization string does not conform to the OLE DB specification."
我也尝试过另一种方式,但出现错误:
"could not find installable isam"
但我没有密码了。
有人可以帮助我,我在 google
上查看了几乎所有内容
我真的不明白你在做什么,但看起来你正在尝试建立连接(查看你的代码)....尝试用你正在做的事情做这样的事情.. ..
Dim g_cnDB as ADODB.Connection
Set g_cnDB as ADODB.Connection
g_cnDB.ConnectionString = "Provider=TEXT;User ID=TEXT; Pwd=TEXT; Initial Catalog=TEXT; Data Source=TEXT"
'Then set it's timeout to be unlimited, so your connection remains open until you close it
g_cnDB.CommandTimeout = 0
'Establishing the connection
g_cnDB.Open
我在一个星期内遇到了一个问题,但我找不到解决方案。我正在尝试在 vb6 上读取 xlsx 中的文件作为 asp 经典的一个组件。
我无法解决的第一个问题是这个
Dim cn As New ADODB.Connection
Dim provider As String
provider = "Driver={Microsoft Excel Driver (*.xlsx)};DBQ=" & nomArq & ";"
Set cn = CreateObject("ADODB.Connection")
cn.Open provider
我在这方面遇到的错误是
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
第二次尝试是这样
Dim cn As New ADODB.Connection
'Dim provider As String
With cn
.provider = "Microsoft.ACE.OLEDB.12.0;Data Source=" & nomArq & ";" & ";Extended Properties=\""Excel 8.0;HDR=Yes\;"""
.Open
End With
错误是
"Format of the initialization string does not conform to the OLE DB specification."
我也尝试过另一种方式,但出现错误:
"could not find installable isam"
但我没有密码了。
有人可以帮助我,我在 google
上查看了几乎所有内容我真的不明白你在做什么,但看起来你正在尝试建立连接(查看你的代码)....尝试用你正在做的事情做这样的事情.. ..
Dim g_cnDB as ADODB.Connection
Set g_cnDB as ADODB.Connection
g_cnDB.ConnectionString = "Provider=TEXT;User ID=TEXT; Pwd=TEXT; Initial Catalog=TEXT; Data Source=TEXT"
'Then set it's timeout to be unlimited, so your connection remains open until you close it
g_cnDB.CommandTimeout = 0
'Establishing the connection
g_cnDB.Open