access2000和accessxp的区别我想只有微软知道
内部技术我们不可能知道,替换成你的数据库路径和密码就可以连接有密码的数据库
Dim cnn1 As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cnnstr As String
Set cnn1 = New ADODB.Connection
cnn1.Open "provider=Microsoft.jet.OLEDB.4.0;Data Source=" & App.Path & "\test.mdb;Jet OLEDB:Database Password=1111"Set rst = New ADODB.Recordset
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
rst.Open "select * from 11", cnn1Set Form1.MSHFlexGrid1.DataSource = rst
rst.Close
cnn1.Close

解决方案 »

  1.   

    strconn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataFile & ";Persist Security Info=False;Jet OLEDB:database password=" & password
      

  2.   

    谢谢,我现在还有另一种方法也可以:
    Dim cnn1 As ADODB.Connection
    Dim rst As ADODB.Recordset
    Dim cnnstr As String
    Set cnn1 = New ADODB.Connection
    cnn1.open "Data Source=C:\Documents and Settings\Administrator\桌面\Demo\test.mdb;Extended Properties=';pwd=1111';Persist Security Info=True"
    Set rst = New ADODB.Recordset
    rst.CursorType = adOpenKeyset
    rst.LockType = adLockOptimistic
    rst.Open "select * from 11", cnn1Set Form1.MSHFlexGrid1.DataSource = rst
    rst.Close
    cnn1.Close
      

  3.   

    oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
               "Dbq=" & Server.MapPath(".") & "\myDb.mdb;" & _
               "Uid=admin;" & _
               "Pwd=;"
    %>This assumes the MDB is in the same directory where the ASP page is running. 
    Also make sure this directory has Write permissions for the user account.
     If you don't know the path to the MDB (using VB)oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
               "Dbq=" & App.Path & "\myDb.mdb;" & _
               "Uid=admin;" & _
               "Pwd=;"This assumes the MDB is in the same directory where the application is running.