empty ResultSet...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: empty ResultSet...

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Reisterstowwn, MD
    Posts
    72

    empty ResultSet...

    Ok, quick question...hopefully someone will know. What is the best way to determine if a ResultSet is empty for a FORWARD ONLY ResultSet?? You can't use the first method because it is for scrollable result sets. next() would return false if the ResultSet is empty but it will also move the cursor forward. I want a way to check if the ResultSet is empty on a forward only ResultSet without moving the cursor forward. If anyone knows I'd appreciate your comments.

    Thanks,
    Ryan
    Java has 99 problems but a pointer ain't one

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    if (rs.next())
    {
    // rs is not empty
    }
    else
    {
    //rs is empty
    }

    note that when using this approach, you'll have to use a do-while loop to loop through the records, since you are already at the dirst one.

Similar Threads

  1. SQLServer and empty strings
    By JBird in forum Database
    Replies: 2
    Last Post: 06-09-2005, 04:23 PM
  2. Significance of System.EventArgs?
    By Paul Mc in forum .NET
    Replies: 5
    Last Post: 06-06-2001, 05:10 PM
  3. Replies: 3
    Last Post: 04-14-2001, 04:18 AM
  4. Resultset implementation
    By KNR in forum Java
    Replies: 2
    Last Post: 06-23-2000, 08:13 PM
  5. Using SQL Against Resultset
    By Faina in forum VB Classic
    Replies: 4
    Last Post: 04-25-2000, 09:53 AM

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center