moving through a record set

S

Steve Hoyer

This page returns the error :

C:\jakarta-tomcat-5.0\work\Standalone\localhost\_\tax\tax40saleshistory_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:eek:dbc:webodbc","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>
 
M

Michael Winter

Steve Hoyer wrote on 20 Nov 2003:
I have narrowed it down to

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

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
 
D

dlbjr

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

-dlbjr

Discerning resolutions for the alms
 
S

Steve Hoyer

Michael Winter said:
Steve Hoyer wrote on 20 Nov 2003:


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

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.
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top