Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

result set is null

Thread view: 
ashutosh - 07 Jun 2005 10:28 GMT
i m working in jsp and i m executing a query like :

String var="select * from reservation where starting_time='"+i+"' and
allocation_no='"+j+"'";

ResultSet rs = st1.executeQuery(var);

now i want to check whether rs contains some value in it or not.

so what syntax should i use for this...

i want to use it for if-statement like....

if (rs is null)
execute this
else
execute this

please help....
Murray - 07 Jun 2005 11:38 GMT
> i m working in jsp and i m executing a query like :
>
[quoted text clipped - 15 lines]
>
> please help....

if (rs.next()) {
   doStuff
} else {
   doOtherStuff
}
Manish - 08 Jun 2005 06:09 GMT
if(rs !=null )..If u want to check resultset is null or not.
or
rs.wasNull() ..Reports whether the last column read had a value of SQL
NULL.
Hal Rosser - 11 Jun 2005 03:46 GMT
I believe you can use the isAfterLast() method and the isBeforeFirst()
method of the Resultset. If both return true, then no records are in the
resultset.

if (rs.isBeforeFirst() && rs.isAfterLast()){
       // rs is empty
}

> i m working in jsp and i m executing a query like :
>
[quoted text clipped - 15 lines]
>
> please help....


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.