aspose file tools*
The moose likes JDBC and the fly likes about Null in ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "about Null in ResultSet" Watch "about Null in ResultSet" New topic
Author

about Null in ResultSet

saravana kumar
Ranch Hand

Joined: Jun 25, 2002
Posts: 72
hi friends,
i needs ur help. how to check wheather Result is null or Not.i have written a query which is selecting data from table with one condition. if there is none of a record satisfied the condition it should be returned null. how to check that one? any one knows please let me know with example.

thanks a lot friends...
saran
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
use
if(ResultSet.next())
{
do this
}
else
{
do that
}

njoy
regds


Want to do something great will do one day
Nandkishore Dhilde
Greenhorn

Joined: May 09, 2002
Posts: 20
or you can do after firing query
int rowcount = rs.getRow(); //rs is ResultSet object
if(rowcount ==0) // then ur query returns null result and if more than 0 then go for rs.next()


SCJP1.4 certified, IBM SOA Solution Designer[2007]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about Null in ResultSet
 
Similar Threads
Vector question?
null pointer exception
java.lang.NullPointerException
Question re: nested IF statements
null value