Paul,
Thanks for responding to my post. I noticed that you had
similiar problems with ADO.NET from your posting on .Net
247
(
http://www.dotnet247.com/247referenc...25/127645.aspx
). Did you ever get the problems with ADO resolved or did
you use directory services in place of ADO to query AD?
I've used System.DirectoryServices with some success. I
have code that uses
System.DirectoryServices.DirectorySearcher and runs
several times in a row before it stops working. For
instance, I run the code and retrieve results 10 times in
a row. I then wait several minutes and attempt to run the
code again and it hangs. Eventually, the method returns a
message:
An unhandled exception of
type 'System.Runtime.InteropServices.COMException'
occurred in system.directoryservices.dll
Additional information: Unknown error (0x80005000)
I reboot my development box and the code runs fine again
(for awhile). Maybe I'm hitting a connection limit? I'm
not sure what system services (on either the client or
server side) that System.DirectoryServices depend on?
When I reboot, something is getting reset that causes the
code to run again. This is why I began looking at ADO.NET
as an alternative.
Thanks!
>-----Original Message-----
>On Mon, 25 Aug 2003 12:09:12 -0700, "Adam Hafner"
<(E-Mail Removed)> wrote:
>
>¤ I am attempting to use the System.Data.OleDb namespace
to
>¤ connect to an Active Directory running under Win2000.
I
>¤ have initialized the OleDbConnection with a connection
>¤ string of "Provider=ADSDSOObject;". I have a simple
query
>¤ string as follows: "SELECT sAMAccountName
>¤ FROM 'LDAP://mydomain.com/' WHERE objectClass = 'User'"
>¤
>¤ I receive an errror when I try to read the
>¤ results: "OleDbDataReader result =
myCommand.ExecuteReader
>¤ (CommandBehavior.CloseConnection);"
>¤
>¤ The error states: DB_E_ERRORSINCOMMAND(0x80040E14) -
An
>¤ unhandled exception occurred during the execution of
the
>¤ current web request.
>¤
>¤ Any samples or suggestions are greatly appreciated.
>
>In addition to the other suggestions, I would first try
to trap the error using Try...Catch. I
>haven't heard anything that indicates that the AD
provider is not supported by the OLEDB .NET
>provider.
>
>There are different ways to query but I've typically
used the default naming context. In my instance
>it's: LDAP://DC=testdomain,DC=org but you should be able
to use DirectoryServices to extract this
>information.
>
>Also, I would try removing the
CommandBehavior.CloseConnection argument to see if it
makes any
>difference.
>
>
>Paul ~~~ (E-Mail Removed)
>Microsoft MVP (Visual Basic)
>.
>