0

下面是我正在使用的代码

Private Sub Form_Load()
    On Error Resume Next

    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Smart Invoice\Smartdata.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "Select * From tableSerMast"

End Sub

我得到低于所说的错误:

[ADODC]:未指定 RecordSource。[ADO]:没有为命令对象设置命令文本

4

1 回答 1

0

我将假设 VBA,如果这就是您的意思,那么更改为 VB6 应该不会太难。

 Private Sub Form_Load()
    ''Almost never a good idea
    ''On Error Resume Next
    ''Reference: Microsoft ActiveX Data Objects x.x Library
    Dim adodc1 As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
        & "Data Source=D:\Smart Invoice\Smartdata.mdb;" _
        & "Persist Security Info=False"
    Adodc1.Open

    rs.Open "Select * From tableSerMast", Adodc1
End Sub
于 2012-08-03T10:47:32.240 回答