Lm th? no ? s? d?ng ADO ? truy c?p cc ?i t?ng thng qua m?t nh cung c?p ADSI LDAP

D?ch tiu ? D?ch tiu ?
ID c?a bi: 187529 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Ho?t ?ng th m?c d?ch v? nh? giao di?n (ADSI) Directory Access Protocol (LDAP) m nh cung c?p th?c hi?n OLE DB giao di?n m cho php b?n s? d?ng ActiveX Data Objects (ADO) ? truy c?p cc ?i t?ng trong LDAP tun th? th m?c. B?n c?n ph?i t?o m?t ADO ?i t?ng k?t n?i v thi?t l?p c?a n Nh cung c?p ti s?n ? "adsdsoobject". B?n c th? xc ?nh b?t k? chu?i, bao g?m c? "", nh chu?i k?t n?i (?i s? ?u tin) k?t n?i ADO phng php m? c?a ?i t?ng.

Phng ?i t?ng thi cng th?c k?t n?i c?a CommandText (?u tin) l m?t LDAP truy v?n bao g?m b?n y?u t? cch nhau b?ng d?u ch?m ph?y, trong cc ?nh d?ng sau:
   <LDAP://server/adsidn>;ldapfilter;attributescsv;scope
				
ni:
  • my ch? l tn (ho?c ?a ch? IP) c?a my ch? lu tr? cc th m?c.
  • adsidn l tn phn bi?t (DN) l i?m kh?i ?u cho b?n truy v?n by t? ADsPath ?nh d?ng v?i "/" tch v g?c c?a cc khng gian tn bn tri. B?n c?ng c th? s? d?ng m?t X.500 phong cch quy cho tn ?nh d?ng v?i tn phn bi?t tng ?i cch nhau b?ng d?u ph?y v cc g?c c?a khng gian tn bn ph?i.
  • 1dap l?c l chu?i l?c LDAP (xem rfc2254).
  • attributescsv l m?t danh sch d?u ph?y ngn cch tn thu?c tnh ? ?c tr? l?i cho m?i hng nm recordset.
  • ph?m vi l m?t trong hai: base, onelevel, ho?c subtree.
LU ?: rfc2253 xc ?nh cch LDAP m trn c php ADSI LDAP d?a.

? tr? v? thu?c tnh ADsPath, l?p h?c, v cn c?a t?t c? cc ?i t?ng trong t?t c? cc cc thng ch?a ng?i nh?n trong m?t my ch? Exchange, b?n c th? s? d?ng sau y CommandText (? ?nh d?ng URL):
      LDAP:<//server/o=organization/ou=site/cn=recipients>;
         (objectClass=*);ADsPath,objectClass,cn;subtree"
				
ho?c (trong quy ?nh d?ng tn):
     <LDAP://server/cn=recipients,ou=site,o=organization>, _
         (objectClass=*);ADsPath,objectClass;subtree
				

THNG TIN THM

Visual Basic m?u m? sau y minh ho? truy v?n ny:

M?u m?

  Dim conn As ADODB.Connection
      Dim rs As ADODB.Recordset

      Set conn = New ADODB.Connection
      conn.Provider = "ADSDSOObject"
      conn.Open "ADs Provider"

      Set rs = conn.Execute( _ 
            "<LDAP://server/o=organization/ou=site/cn=recipients>;" _
            & "(objectClass=*);ADsPath,objectClass,cn;subtree")

      While Not rs.EOF
         Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, _
               rs.Fields(2).Value
         rs.MoveNext
      Wend

      conn.Close


				

THAM KH?O

? c m?t danh sch v gi?i thch v? ph? bi?n LDAP RFCs, bao g?m c? RFC 2253 v RFC 2254, xin vui l?ng xem bi vi?t sau trong c s? ki?n th?c Microsoft:
221606 Ph? bi?n LDAP RFCs
? bi?t thm chi ti?t, b?m vo s? bi vi?t d?i y ? xem bi vi?t trong c s? ki?n th?c Microsoft:
275917 PRB: ADSI 2,5 v MDAC 2.6 di tng thch v?n ?

Thu?c tnh

ID c?a bi: 187529 - L?n xem xt sau cng: 20 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
T? kha:
kbhowto kbmdacnosweep kbtophit kbmt KB187529 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:187529

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com