[英]adodb connection erroring during open of recordset
Using VB6 & ADODB to open access 2000 DB. 使用VB6和ADODB打开Access 2000 DB。 Connection string opens.
连接字符串打开。 I verify this by getting the .STATE of the connection before opening recordset.
我通过在打开记录集之前获取连接的.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
The below snippet shows the line where the error occurs 下面的代码段显示了发生错误的行
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
EDIT: Exact error message is Run-Time Error '-2147467259 (80004005)': Could not find file 'C:\\Program Files (x86)\\Microsoft Visual\\VB98\\dbo.mdb'
编辑:确切的错误消息是
Run-Time Error '-2147467259 (80004005)': Could not find file 'C:\\Program Files (x86)\\Microsoft Visual\\VB98\\dbo.mdb'
Both your snippets are coded as 'Private' which means they don't share well. 您的两个摘要均被编码为“私人”,这意味着它们共享不佳。 You 'Go' button isn't clear on what the actual 'ActiveConnection' was set to be earlier in the Form load.
在“实际”“ ActiveConnection”设置为早于Form加载时,“ Go”按钮不清楚。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.