Set Cn1 = New ADODB.Connection
Cn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DataBaseName + ";Persist Security Info=False;Jet OLEDB:database password=kkkkkkk"
Set Rslin = New ADODB.Recordset
Rslin.Open "Select * from table where ......" , Cn1, adOpenStatic

解决方案 »

  1.   

    With DBConnect
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Properties("Data Source").value = App.Path & "\data.mdb"
        .Properties("Persist Security Info").value = True          '关键是这个.
        .Properties("Jet OLEDB:Database Password").value = "hello"
    '   .Properties("Initial Catalog").Value = mvarDatabaseName
    '   .Properties("Data Provider").Value = "SQLOLEDB.1"
        .CommandTimeout = 30
    End With
      

  2.   

    With DBConnect
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Properties("Data Source").value = App.Path & "\data.mdb"
        .Properties("Persist Security Info").value = True          '关键是这个.
        .Properties("Jet OLEDB:Database Password").value = "hello"
        .CommandTimeout = 30
    End With