problem with active directory code: object not set to an instance of an object

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-size:small <span style="font-size:small I have a code section in my current active directory program in which it gives the error in the title above at the line:
If results.Path = "" Then from below<span style="font-size:small code:
<pre class="prettyprint lang-vb Dim results As SearchResult = Nothing
currentADObject = New DirectoryEntry("LDAP://OU=090_Paint Lick EL,OU=Staff,DC=garrard,DC=ketsds,DC=net", "", "", AuthenticationTypes.Secure)
Dim ADFind As DirectorySearcher = New DirectorySearcher(currentADObject)
If username <> "" Then
ADFind.Filter = "(&(objectCategory=user)(cn=" + username + "))"
Else
Exit Select
End If
results = ADFind.FindOne
If results.Path = "" Then
MsgBox("empty results")
End If[/code]
<br/>

<
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog
- http://jefferycarlsonblog.blogspot.com/
<br/>
<br/>

View the full article
 
Back
Top