-
how to find whether a result set is null or not
hi guys...i am new to jsp...does any one know how to detect whether a result set in null or not....here i was writing a small prog on jsp..and in that prog i hve to check for a value which is there in the database or not..i hve executed the query using
rs=statement.executeQuery("SELECT * from user_accounts WHERE id='"+record_id+"'");
here record_id id the primery key
and i hve written a statement
try
{
rs.next();
}catch(SQLException e)
{
flag=true;
}
and sometimes it doest works that is it doesnt detects if the result set is null
is the any other way to the same procedure
-
Use this sentence previously to rs.next():
if (rs!=null)
{
while(rs.next())
{
//Do whatever
}
}
Answer provided by http://www.consultoriajava.com
Similar Threads
-
By Hector Diaz in forum Database
Replies: 1
Last Post: 10-23-2001, 06:17 PM
-
By Crispin Wright in forum VB Classic
Replies: 0
Last Post: 08-23-2001, 11:55 AM
-
By Jeff Morgan in forum VB Classic
Replies: 2
Last Post: 02-13-2001, 10:49 AM
-
By Robert Gelb in forum VB Classic
Replies: 3
Last Post: 01-12-2001, 02:17 PM
-
By Bob Hines in forum Database
Replies: 2
Last Post: 04-13-2000, 01:53 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks