【发布时间】:2013-10-31 17:59:42
【问题描述】:
使用VB6 & ADODB 开启access 2000 DB。连接字符串打开。我通过在打开记录集之前获取连接的 .STATE 来验证这一点。
Private Sub Form_Load()
With conn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Path to database\MyDb.mdb;"
End With
conn.Open
Debug.Print conn.ConnectionString
End Sub
下面的sn -p 显示错误发生的那一行
Private Sub btnGO_Click()
Dim strDbName As String
Dim strg As String
Dim chkr As Variant
Dim MyCnt As Integer
chkr = False
Dim strsql As String
strsql = "Select * from [dbo].[BidItem]"
With rst
.ActiveConnection = conn
.Source = "Select * from [dbo].[BidItem]"
.Open -------------------------------------> Errors at this point
End With
With rst
If Not .EOF And Not .BOF Then
.MoveFirst
MyCnt = .RecordCount
End If
End With
MsgBox ("open")
MsgBox ("Count of TableRows: " & MyCnt)
Set rst = Nothing
End Sub
编辑:确切的错误消息是Run-Time Error '-2147467259 (80004005)': Could not find file 'C:\Program Files (x86)\Microsoft Visual\VB98\dbo.mdb'
【问题讨论】:
-
确切的错误消息是运行时错误'-2147467259 (80004005)':找不到文件'C:\Program Files (x86)\Microsoft Visual\VB98\dbo.mdb'。跨度>
-
在不泄露任何登录信息的情况下,您的 conn 连接字符串中有什么?
-
如果省略
[dbo].限定符而只使用SELECT * FROM [BidItem]会发生什么? -
Access 了解 dbo 吗?你试过'select * from biditem'吗?
-
谢谢大家。 “dbo”。在那里是因为访问数据库链接到 SQL 数据库。我断开了链接并删除了“dbo”。我能够访问 Access Db。然后我将链接添加回来,仍然能够通过 Access DB 访问 SQL DB。
标签: ms-access vb6 connection adodb