Home » Developer & Programmer » JDeveloper, Java & XML » How to know if we have a result with JDBC ???
How to know if we have a result with JDBC ??? [message #91205] Tue, 28 May 2002 02:06 Go to next message
hug
Messages: 6
Registered: May 2002
Junior Member
Hi,

I'm actually writing in Java, a application that access a external database. So I use JDBC to access to the data.
I can connect to database, make my query with no problem.
But I have one question ...
How can I know if they are some result associated with one of my query.
For example I make a SELECT statement, and before display the results I want to know if they are some results !!!
I have found one the web some explanations (like use resultset==null or something like that but it doesn't work in my application).

So if anybody know a solution that work all the time, thanks to respond !!! (with some code example if possible)

best regards

Hug
Re: How to know if we have a result with JDBC ??? [message #91208 is a reply to message #91205] Wed, 29 May 2002 06:08 Go to previous messageGo to next message
lenon
Messages: 5
Registered: May 2002
Junior Member
look at resultset.next() method in javadoc
Re: How to know if we have a result with JDBC ??? [message #91211 is a reply to message #91205] Thu, 30 May 2002 05:15 Go to previous message
boticellus
Messages: 4
Registered: May 2002
Junior Member
StringBuffer s=new StringBuffer(300);

while (rs.next()) {
s.append("HTML code");
}
or if your not using JSP

while (rs.next()) {
System.out.println...
}

return s.toString ();

}
Previous Topic: Help with JSP and Oracle
Next Topic: Re: maximum open cursors exceeded
Goto Forum:
  


Current Time: Fri Nov 29 16:04:23 CST 2024