Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
>Is there something wrong in my codes below?, it does not work.. please help .. and thanks
>
>
>Private Sub Form_Load()
>Dim mSetupDir as String
>
>mSetupDir = App.Path & "\Setup.MDB"
>'
>adoDep.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & mSetupDir & ";Persist Security Info=False"
>'
>adoDep.RecordSource = "Select * from Department Where Department.Dept like 'A*' order by Department.Dept"
>
>End Sub
You have to open your Connection and your RecordSet:
ex:
Set adoDep = New ADODB.Connection
With adoDep
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
mSetupDir & ";Persist Security Info=False"
.Open
End With
Dim rsDep As New ADODB.RecordSet
rsDep.RecordSet.open "Select * from Department Where Department.Dept like
'A*' order by Department.Dept", adoDep, adOpenStatic, adLockOptimistic
I hope this will help you.
Précédent
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