Title: Message
thank you Surya Narayana. =)
 
 
Rama
 
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]] On Behalf Of Surya Narayana
Sent: Wednesday, January 30, 2002 11:37 PM
To: [EMAIL PROTECTED]
Subject: Re: JDBC

Hello Rama,
 
   You are using rs.next() twice. Thats why it is skipping the first record. Its enough to use rs.next() in while loop. no need of if loop.
 
Thanks & Regards,
 
Surya
 
----- Original Message -----
From: Rama
Sent: Thursday, January 31, 2002 11:53 AM
Subject: JDBC

Hi,

I wonder how to know if the query returned is empty or not.

I use this code:
ResultSet rs = stmt.executeQuery("SELECT * FROM user");

if (rs.next()) {
  while (rs.next()) {
    out.println("username " + rs.getString("username"));
  }
}
else {
  out.println("No record found");
}


but it always skips the first line of the record.

1. How to know if the query returned is empty or not.

2. Also, is there any way to know how many records returned?


Thank you,


Rama

Reply via email to