Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Open a connection with security on msaccess database?
hi all -
i'm using vb6 sp5 and an ms access2000 database. i can access the database fine with the code below but i'm having trouble when i put a password on the database. the error that i receive is "run-time error: could not find installable ISAM". the code below is what i'm using for establishing a connection and the error occurs on the line "oConn.Open strConnection". the database name is security and so is the password.
***** begin
Dim oConn As New ADODB.Connection
Dim rsObj As ADODB.Recordset
Dim strConnection, strQuery, strDBPath As String
Dim strPwd As String
Dim strDatabasePath As String
strDBPath = "c:\data\test\"
Set rsObj = New ADODB.Recordset
rsObj.CursorLocation = adUseClient
' get password for database
strPwd = "security"
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "security.mdb;Pwd=" & strPwd & ";Persist Security Info=False"
strQuery = "select * from security"
oConn.Open strConnection
rsObj.ActiveConnection = oConn
rsObj.Open strQuery, , adOpenDynamic, adLockPessimistic
If rsObj.EOF = False Then
rsObj.MoveFirst
End If
*** end
any thoughts? TIA
piper
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement