hi,
I connect to the Active Directory in a webapplication through LDAP. That works good, but I have one problem.
When I try to give out the CN, I get an Errormessage.
Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.
The ADsPath can be given out without any problems.
Please look at my Sourcecode and help me if you can.
Thanks,
Urs
Code:
<%@language="vbscript"%>
<%
Option Explicit
Response.Expires = 0
Dim strQuery
Dim objUser
'---------------------------------------------
'Connection
'---------------------------------------------
Dim objRstMain, objConMain, objCmdMain
Set objRstMain = Server.CreateObject("ADODB.RecordSet")
Set objConMain = Server.CreateObject("ADODB.Connection")
Set objCmdMain = Server.CreateObject("ADODB.Command")
objConMain = "Provider=ADSDSOObject;User Id=PRIVATE\Administrator;Password=qwerASDF;Encrypt Password=False;Open=Active Directory Provider"
strQuery = "SELECT cn, ADsPath FROM 'LDAP://192.168.1.1/OU=Customers, DC=cust, DC=mydomain, DC=com' WHERE objectCategory='user'"
objCmdMain.ActiveConnection = objConMain
objCmdMain.CommandText = strQuery
%>
<html>
<head>
</head>
<body>
<table cellspacing="1" cellpadding="1" width="300" border="1" ID="Table1">
<%
Set objRstMain = objCmdMain.Execute
'Response.Write(objRstMain.RecordCount)
%>
<b>Anzahl Datensätze: </b>
<% =objRstMain.RecordCount %>
<br><br>
<%
Do While Not objRstMain.EOF
%>
<tr>
<td><% =objRstMain.Fields("cn").Value %></td>
<td><% =objRstMain.Fields("ADsPath").Value %></td>
</tr>
<%
objRstMain.MoveNext
Loop
objRstMain.Close
Set objRstMain = Nothing
Set objConMain = Nothing
Set objCmdMain = Nothing
%>
</table>
</body>
</html>