Connecting Tech Pros Worldwide Help | Site Map

moving through a record set

  #1  
Old July 20th, 2005, 01:00 PM
Steve Hoyer
Guest
 
Posts: n/a
This page returns the error :

C:\jakarta-tomcat-5.0\work\Standalone\localhost\_\tax\tax40saleshist ory_jsp.java:135:
illegal start of expression

I have narrowed it down to

<% while (rs.next()){
<% } %>

causing the problems. If I remove these two lines, the page loads
fine, but with only one line of data.

I have used the same syntax on a different page, but cannot now get
this page to work. Thanks for any assistance.

Page Code Below:

<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
<% java.sql.Connection db =
java.sql.DriverManager.getConnection("jdbc:odbc:we bodbc","user","pw");
%>
<% java.sql.Statement st = db.createStatement(); %>
<% java.sql.ResultSet rs; %>
<% String stComplete=request.getParameter("address"); %>
<% String stParcel=request.getParameter("parcel"); %>

<% rs=st.executeQuery("pEQGetPastSales '" + stParcel + "';"); %>
<% rs.next();
String pn= rs.getString(1);
String salesdate= rs.getString(2);
String salesprice= rs.getString(3);
%>

<html>

<head>
</head>

<body>


<table width=700 align="center" cols="2" border="0">
<tr align=center>
<td><h3>Address: <%= stComplete %></h3></td>
<td><h3>Parcel: <%= stParcel %></h3></td>
</tr>
<tr>
<td colspan=2>
<table cols="2">
<% if (salesprice.equals("")) { %>
<tr><td colspan="2">No sales.</td></tr>
<% } else { %>
<% while (rs.next()){
<tr><td><%= salesdate %></td>
<td><%= salesprice %></td>
</tr>
<% } %>
<% }; %>
</table>
</td>
</tr>
</table>

</body>

<% rs.close(); %>

<% db.close(); %>

</html>
  #2  
Old July 20th, 2005, 01:01 PM
Michael Winter
Guest
 
Posts: n/a

re: moving through a record set


Steve Hoyer wrote on 20 Nov 2003:
[color=blue]
> I have narrowed it down to
>
> <% while (rs.next()){
> <% } %>[/color]

This has nothing to do with JavaScript, but it seems that you didn't
close the tags. Shouldn't it be:

<% while (rs.next()){ %>
^^
statements...
<% } %>

I don't know JSP (is this JSP?), but that's what seems to be the
obvious problem.

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
  #3  
Old July 20th, 2005, 01:01 PM
dlbjr
Guest
 
Posts: n/a

re: moving through a record set


while(!rs.EOF){
//Do What Ever.
rs.MoveNext()
}

-dlbjr

Discerning resolutions for the alms


  #4  
Old July 20th, 2005, 01:01 PM
Steve Hoyer
Guest
 
Posts: n/a

re: moving through a record set


Michael Winter <M.Winter@blueyonder.co.uk.invalid> wrote in message news:<Xns9439F19428C65MWinterBlueyonder@193.38.113 .46>...[color=blue]
> Steve Hoyer wrote on 20 Nov 2003:
>[color=green]
> > I have narrowed it down to
> >
> > <% while (rs.next()){
> > <% } %>[/color]
>
> This has nothing to do with JavaScript, but it seems that you didn't
> close the tags. Shouldn't it be:
>
> <% while (rs.next()){ %>
> ^^
> statements...
> <% } %>
>
> I don't know JSP (is this JSP?), but that's what seems to be the
> obvious problem.
>
> Mike[/color]

Sometimes you can't see the forest for the trees, sometimes you can't
see the trees for the forest. Thanks for the syntax catch.

Steve.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine when mousewheel stops moving? =?Utf-8?B?UmljaA==?= answers 1 March 22nd, 2007 07:45 PM
Moving through records in a dataview brix_zx2 answers 1 November 21st, 2005 02:44 PM
Trying to loop through a recordsets in Access Mike Wilson answers 3 November 12th, 2005 05:05 PM
python-dev Summary for 2004-08-01 through 2004-08-15 Brett Cannon answers 17 July 18th, 2005 03:27 PM