DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    6

    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

  2. #2
    Join Date
    Oct 2005
    Posts
    6
    Use this sentence previously to rs.next():


    if (rs!=null)
    {
    while(rs.next())
    {
    //Do whatever
    }
    }

    Answer provided by http://www.consultoriajava.com

Similar Threads

  1. String literal result set
    By Hector Diaz in forum Database
    Replies: 1
    Last Post: 10-23-2001, 06:17 PM
  2. Find Dialog - Set the "Look In" path.....
    By Crispin Wright in forum VB Classic
    Replies: 0
    Last Post: 08-23-2001, 11:55 AM
  3. Problems with NetAddUser
    By Jeff Morgan in forum VB Classic
    Replies: 2
    Last Post: 02-13-2001, 10:49 AM
  4. Driving me nuts
    By Robert Gelb in forum VB Classic
    Replies: 3
    Last Post: 01-12-2001, 02:17 PM
  5. Replies: 2
    Last Post: 04-13-2000, 01:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links