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!

Expected End Of What?!?!?

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
I am getting the error: Expected End Of Statement for the following code. What I am trying to do is get the first 5 records from the database.

<%
Set ObjConn = Server.CreateObject(&quot;Adodb.Connection&quot;)
SQLQry2 = &quot;Select * From Journal&quot;
Objconn.Open (Application(&quot;Datasource&quot;))
Set Objrs = Objconn.Execute(SQLQry2)
For I = 1 to 5
Response.write Objrs(&quot;Title&quot;)
Objrs.Movenext
Next X
%>

I really dont understand why I would get this error, Can someone please explain? :) Also is there any other wayy of getting the first 5 records like i know how to do a Do WHile not rs.Eof, but is there like a Do while not Rs.Record =>5 or something like that?

Thanks! Gordon R. Durgha
gd@vslink.net
 
Well I don't know VB but this doesn't look right to me...

For I = 1 to 5
Next X

Shouldn't that be
Next I

-pete
 
I changed up the code previously to check something that still wont fix the problem heh sorry about that the new code is...


<%
Set ObjConn = Server.CreateObject(&quot;Adodb.Connection&quot;)
SQLQry2 = &quot;Select * From Journal&quot;
Objconn.Open (Application(&quot;Datasource&quot;))
Set Objrs = Objconn.Execute(SQLQry2)
For I = 1 to 5
Response.write Objrs(&quot;Title&quot;)
Objrs.Movenext
Next I
%>
Gordon R. Durgha
gd@vslink.net
 
psst my 2 cents

Strange but true. VBScript refuses to acknowledge the variable after the Next statement whereas it's good practice to use as a Visual Basic Coder.

hmmm...nice one microSOFT.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top