Error with reponse.write

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>"
 
B

Bob Barrows [MVP]

CD said:
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>"

Response.Write "<TD>" & adoRecordSet.Fields("cn").Value & _
"</TD>"

Bob Barrows
 
C

CD

Thanks for the reply

I still get error on that line.

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/adlookup/results.asp, line 89
 
B

Bob Barrows [MVP]

I can't help without knowing what's in the recordset. Save your recordset to
an xml file and post the contents of the xml file in your reply to this
message. To save your recordset, do this (after opening it):

adoRecordSet.Save "recordset.xml", 1

You will be able to open the xml file in Notepad and copy the text into your
reply post.

Bob Barrows
 
C

CD

Thanks Bob

I add the line after the set open

' Execute the query for the user in the directory
Set adoRecordSet = adoCommand.Execute

adoRecordSet.Save "recordset.xml", 1

and get

Error Type:
Provider (0x80030103)
Can't save.
/adlookup/results.asp, line 82
 
B

Bob Barrows [MVP]

CD said:
Thanks Bob

I add the line after the set open

' Execute the query for the user in the directory
Set adoRecordSet = adoCommand.Execute

adoRecordSet.Save "recordset.xml", 1

and get

Error Type:
Provider (0x80030103)
Can't save.
/adlookup/results.asp, line 82

You need to save it into a folder where either you or the IUSR account
(depending on what kind of authentication is being used by the site) has
file creation permissions.

As an alternative, you can use the code on this page to pass the recordset
xml to the client:
http://www.davidpenton.com/testsite/tips/xml.recordset.server2client.asp

and then view the page's source to copy the xml.
 
C

CD

OK I gave the IUSR acct permission to write to my local drive.
This is what I get with the line Line87: adoRecordSet.Save "recordset.xml",
1

Error Type:
Microsoft OLEDB Persistence Provider (0x80040E1D)
Requested conversion is not supported.
/adlookup/results.asp, line 87

This being the case do you think the page conversion will even work?

I reall appericate your help on this.
 
B

Bob Barrows [MVP]

What version of ADO do you have? You can find out by doing

response.write conn.version

Any chance of upgrading to the latest version?

What do you get when you do

response.write adoRecordSet.Fields("cn").Type

Bob Barrows
 
C

CD

WaaaHOO

The join did it..

THANKS MUCHO!


Bob Barrows said:
I've just done a Google search and found a couple promising posts:

http://groups.google.com/groups?hl=...-8&c2coff=1&selm=uo$UQLU$AHA.1528@tkmsftngp04

Try
Response.Write "<TD>" & join(adoRecordSet.Fields("cn")) & "</TD>"

Bob Barrows




--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top