C
CD
I have code from a book that appears work except for the writing the
reuslts. I am querying AD and writing the results. I get the error:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/adlookup/results.asp, line 89
Which is the line> Response.Write "<TD>" & adoRecordSet.Fields("cn") &
"</TD>"
TIA
CD
CODE SNIP:
' Create ADO connection using the ADSI OLE DB provider
Set adoConnection = Server.CreateObject ("ADODB.Connection")
adoConnection.Open "Provider=ADsDSOObject;"
' Create ADO commmand object and associate with the connection
Set adoCommand = Server.CreateObject ("ADODB.Command")
adoCommand.ActiveConnection = adoConnection
' Create the command string using the four parts
adoCommand.CommandText = strBase & ";" & strFilter & ";" & _
strAttributes & ";" & strScope
' Set the number of records in the recordset logical page
adoCommand.Properties("Page Size") = 20
' Set the maximum result size
adoCommand.Properties("Size Limit") = 20
' Sort the results based on the cn attribute
adoCommand.Properties("Sort On") = "cn"
' Execute the query for the user in the directory
Set adoRecordSet = adoCommand.Execute
If adoRecordSet.EOF Then
Response.Write "</TBODY><THEAD><TH>No names found</TH></THEAD>"
Else
' Loop through all the returned records
While Not adoRecordSet.EOF
' Display the row using the selected fields
Response.Write "<TR>"
Response.Write "<TD>" & adoRecordSet.Fields("cn") & "</TD>"
' Check to see if telephone number field is null
If IsNull( adoRecordSet.Fields("telephoneNumber") ) Then
Response.Write "<TD>(number not listed)</TD>"
Else
' Retrieve the telephone number and add to the display line
Response.Write "<TD>" & _
adoRecordSet.Fields("telephoneNumber") & "</TD>"
End If
' End the row
Response.Write "</TR>"
reuslts. I am querying AD and writing the results. I get the error:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/adlookup/results.asp, line 89
Which is the line> Response.Write "<TD>" & adoRecordSet.Fields("cn") &
"</TD>"
TIA
CD
CODE SNIP:
' Create ADO connection using the ADSI OLE DB provider
Set adoConnection = Server.CreateObject ("ADODB.Connection")
adoConnection.Open "Provider=ADsDSOObject;"
' Create ADO commmand object and associate with the connection
Set adoCommand = Server.CreateObject ("ADODB.Command")
adoCommand.ActiveConnection = adoConnection
' Create the command string using the four parts
adoCommand.CommandText = strBase & ";" & strFilter & ";" & _
strAttributes & ";" & strScope
' Set the number of records in the recordset logical page
adoCommand.Properties("Page Size") = 20
' Set the maximum result size
adoCommand.Properties("Size Limit") = 20
' Sort the results based on the cn attribute
adoCommand.Properties("Sort On") = "cn"
' Execute the query for the user in the directory
Set adoRecordSet = adoCommand.Execute
If adoRecordSet.EOF Then
Response.Write "</TBODY><THEAD><TH>No names found</TH></THEAD>"
Else
' Loop through all the returned records
While Not adoRecordSet.EOF
' Display the row using the selected fields
Response.Write "<TR>"
Response.Write "<TD>" & adoRecordSet.Fields("cn") & "</TD>"
' Check to see if telephone number field is null
If IsNull( adoRecordSet.Fields("telephoneNumber") ) Then
Response.Write "<TD>(number not listed)</TD>"
Else
' Retrieve the telephone number and add to the display line
Response.Write "<TD>" & _
adoRecordSet.Fields("telephoneNumber") & "</TD>"
End If
' End the row
Response.Write "</TR>"