1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| 'Déclaration des variables
Dim cnLDAP As Connection, rsLDAP As Recordset
Private Sub Form_Load()
'Instanciation des variables
Set cnLDAP = New Connection
Set rsLDAP = New Recordset
With cnLDAP
.Provider = "ADSDSOObject"
.ConnectionString = "User ID=gapog.admin;" & _
"Password=Mars12;" & _
"Data Source=LDAP://dc=upstream,dc=apc,dc=grp;" ' & _
'"Initial Catalog=LDAP"
.Open "Active Directory Provider"
End With
With rsLDAP
.ActiveConnection = cnLDAP
'.CursorLocation = adUseClient
'.LockType = adLockBatchOptimistic
.Open "SELECT * FROM 'LDAP://dc=upstream,dc=apc,dc=grp'"
End With
'Affectations rsLDAP!Name
nn = rsLDAP!Name
Set txtName.DataSource = rsLDAP
txtName.DataField = "Name"
Set txtType.DataSource = rsLDAP
txtType.DataField = "Type"
Set txtDescription.DataSource = rsLDAP
txtDescription.DataField = "Description"
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Ferme toutes les connexions
cnLDAP.Close
rsLDAP.Close
Set cnLDAP = Nothing
Set rsLDAP = Nothing
End Sub |
Partager