Uredi

Deli z drugimi prek


Microsoft OLE DB Provider for Microsoft Active Directory Service

The Active Directory Service Interfaces (ADSI) Provider allows ADO to connect to heterogeneous directory services through ADSI. This gives ADO applications read-only access to the Microsoft Windows NT 4.0 and Microsoft Windows 2000 directory services, in addition to any LDAP-compliant directory service and Novell Directory Services. ADSI itself is based on a provider model, so that if there is a new provider giving access to another directory, the ADO application will be able to access it seamlessly. The ADSI provider is free-threaded and Unicode enabled.

Connection String Parameters

To connect to this provider, set the Provider argument of the ConnectionString property to the following:

ADSDSOObject  

Reading the Provider property will return this string as well.

Typical Connection String

A typical connection string for this provider is as follows:

"Provider=ADSDSOObject;User ID=MyUserID;Password=MyPassword;"  

The string consists of the following keywords.

Keyword Description
Provider Specifies the OLE DB Provider for Active Directory Service.
User ID Specifies the user name. If this keyword is omitted, the current logon is used.
Password Specifies the user password. If this keyword is omitted. Then the current logon is used.

Note

If you are connecting to a data source provider that supports Windows authentication, you should specify Trusted_Connection=yes or Integrated Security = SSPI instead of user ID and password information in the connection string.

Command Text

A four-part command text string is recognized by the provider in the following syntax:

"Root; Filter; Attributes[; Scope]"  
Value Description
Root Indicates the ADsPath object from which to start the search (that is, the root of the search).
Filter Indicates the search filter in the RFC 1960 format.
Attributes Indicates a comma-delimited list of attributes to be returned.
Scope Optional. A String that specifies the scope of the search. Can be one of the following:

- Base - Search only the base object (root of the search).
- OneLevel - Search only one level.
- Subtree - Search the whole subtree.

For example:

"<LDAP://DC=ArcadiaBay,DC=COM>;(objectClass=*);sn, givenName; subtree"  

The provider also supports SQL SELECT for command text. For example:

"SELECT title, telephoneNumber From 'LDAP://DC=Microsoft, DC=COM' WHERE   
objectClass='user' AND objectCategory='Person'"  

Remarks

The provider does not accept stored procedure calls or simple table names (for example, the CommandType property will always be adCmdText). See the Active Directory Service Interfaces documentation for a more thorough description of the command text elements.

Recordset Behavior

The following tables list the features available on a Recordset object opened by using this provider. Only the static cursor type (adOpenStatic) is available.

For more information about Recordset behavior for your provider configuration, run the Supports method and enumerate the Properties collection of the Recordset to determine whether provider-specific dynamic properties are present.

Availability of standard ADO Recordset properties:

Property Availability
AbsolutePage read/write
AbsolutePosition read/write
ActiveConnection read-only
BOF read-only
Bookmark read/write
CacheSize read/write
CursorLocation always adUseServer
CursorType always adOpenStatic
EditMode always adEditNone
EOF read-only
Filter read/write
LockType read/write
MarshalOptions not available
MaxRecords read/write
PageCount read-only
PageSize read/write
RecordCount read-only
Source read/write
State read-only
Status read-only

Availability of standard ADO Recordset methods:

Method Available?
AddNew No
Cancel No
CancelBatch No
CancelUpdate No
Clone Yes
Close Yes
Delete No
GetRows Yes
Move Yes
MoveFirst Yes
MoveLast Yes
MoveNext Yes
MovePrevious Yes
NextRecordset Yes
Open Yes
Requery Yes
Resync Yes
Supports Yes
Update No
UpdateBatch No

For more information about ADSI and the specifics of the provider, refer to the Active Directory Service Interfaces documentation or visit the ADSI Web page.

See Also

CommandType Property (ADO)
ConnectionString Property (ADO)
Properties Collection (ADO)
Provider Property (ADO)
Recordset Object (ADO)
Supports Method