Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset error

Status
Not open for further replies.

robertl

Programmer
Jan 8, 2001
23
GB
I'm receiving the following error:

Microsoft JScript compilation error '800a03ec'

Expected ';'

/bulk/bookcargo.asp, line 13

set rs=Server.CreateObject("ADODB.RecordSet")


when I try to run this code:
Code:
<%
//Create a recordset
	set rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)
//Set up a connection string
	connect=&quot;DSN=name&quot;
//Query String
	SQL = &quot;SELECT commodity_desc FROM Commodities ORDER BY commodity_desc&quot;
//Connect to DB and execute query
	rs.open SQL, connect	
%>

Yet, another site that I designed earlier has similar context for the recordset and it works fine. Infact, I
copied it and only changed the SELECT statement and
DNS name, everything else is constructed the same.

What could be the problem?

Thanks in advance.
 
jscript is not vbscript.

you cannot set rs to anything in jscript.

var connect = Server.CreateObject(&quot;ADODB.Connection&quot;);
var rs = Server.CreateObject(&quot;ADODB.Recordset&quot;);
connect.Open(&quot;DSN=;UID=;PWD=;);
var SQL = &quot;SELECT commodity_desc FROM Commodities &quot;;
rs.Open(SQL, connect); adam@aauser.com
 
I just check my other site and I did code it in VBScript.

I had recoded my connection strings to a javascript equivalent and want to transverse the records with a
Code:
do while not rs.eof
Is this allowed in Javascript? A book I have on Javascript
only addresses while loops, yet a site that I just visited
contains the above do-while-not syntax which is something that I used in VB.
When I try to use the code do-while code, I'm told that a ';' is needed with reference to the while statement.

 
while(!rs.EOF)
{
//code.
}

or:

do
{
//code
}
while(!rs.EOF)

btw... i'm not sure if do-while loop is valid javascript... it might be the perl in me talking....

adam@aauser.com
 
Thanks for the info.

I'll have to play around with the example you put down, although it works, in that I get more than just one record displayed, an infinate loop occurs with just the first record being displayed.

 
oh... forgot... you need rs.MoveNext() at the end of the loop. adam@aauser.com
 
I also had to have EOF in smallcase as well.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top