row count in JSP


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: row count in JSP

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    39

    row count in JSP

    I am trying to run an sql statement and have the result set populate in a table on the same page with the search. I know that I have to do a rowcount. If the rowcount is greater than zero, I will display the table, if it is equal to zero, I will display an error message, that there are no results in the table.

    How do I do a row count in JSP?

  2. #2
    Join Date
    Oct 2005
    Posts
    40

    Lightbulb

    You do not need rowcount for above requirement. Simply check on your resultset object

    if( rs.next() )
    {
    //display the table
    }
    else
    {
    //display error msg
    }

    Regards,
    Mohit

  3. #3
    Join Date
    Sep 2005
    Posts
    39
    Thanks I'll try it and see if it works. I am really using a while loop as in while (rs.next())

  4. #4
    Join Date
    Oct 2005
    Posts
    40

    Arrow

    Quote Originally Posted by Maria Modeste
    Thanks I'll try it and see if it works. I am really using a while loop as in while (rs.next())
    Than do this

    Code:
    if( rs.next() )
    {
        do
        {
            //display the table
        }while( rs.next() )
    }
    else
    {
        //display error msg
    }

  5. #5
    Join Date
    Sep 2005
    Posts
    39
    Thanks a mil, it works!

Similar Threads

  1. need to return total record count, but here is the trick...
    By barbarosa80503 in forum VB Classic
    Replies: 2
    Last Post: 10-28-2005, 03:33 PM
  2. Previous & Next Record
    By nickiii in forum .NET
    Replies: 2
    Last Post: 07-01-2005, 12:03 PM
  3. Row count problem
    By Hari in forum VB Classic
    Replies: 3
    Last Post: 07-24-2002, 06:59 PM
  4. Row Count for a table
    By Michael Giordano in forum Database
    Replies: 2
    Last Post: 02-27-2002, 11:25 AM
  5. Replies: 3
    Last Post: 02-15-2002, 01:45 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