Try this.
ResultSet resultSet = execute query here to return a result set
int numRows = 0;
if(resultSet.last()) {
numRows = resultSet.getRow(); // return the row id.
}
One thing to note is if your ResultSet is not setup to for
bi-directional reading, you will lose the use of your ResultSet doing
this.
Bradley M. Handy
Programmer/Analyst
Spring Arbor University
--www.arbor.edu
--mailto:[EMAIL PROTECTED]
-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 2:24 PM
To: Struts Users Mailing List
Subject: Re: how to number of rows in resultset without % ...
TIA,
Try SELECT COUNT() FROM mytable
That should return the # of records returned.
Regards,
Richard
At 01:46 PM 11/16/2001 +0100, you wrote:
Multiple selectbox. It has size attribute which has to be set in order
to
show all rows in database.
I'm using % ... code to get the number of rows in resultSet since I
have
to know it before I take
data and display it in table. Could I get this size at least without
%
..?
sql:preparedStatement ...
sql:query
SELECT * FROM MYTABLE
/sql:query
% int i = 0; %
sql:resultSet id=rsAction loop=true
% i++; %
/sql:resultSet
% String size = + i; %
sql:query
SELECT * FROM MYTABLE
/sql:query
html:select property=segment multiple=true size=%=size
%
sql:resultSet id=rsAction loop=true
% String id = rsAction.getString(1), value =
rsAction.getString(2); %
html:option value=%=id %%=value%/html:option
/sql:resultSet
/html:select
/sql:preparedStatement
TIA,
--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]