Paras,

    Check into theResultSetMetaData class. there is a function
getColumnCount which can be used to do what you need.
Heres a snibbit of code:

   Statement stmt = con.createStatement();
   ResultSet rs = stmt.executeQuery("Select * from TABLENAME");
   ResultSetMetaData meta =  rs.getMetaData();
   int rows = meta.getColumnCount();

the names of the rows can be accessed by doing a "describe TABLENAME", and
then getting the names returned in the "Fields" column.

    -Doug






----- Original Message -----
From: Paras Sharma <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 11, 2000 11:24 AM
Subject: howto get Number of rows


> hi
>
>   can  some tell me  when we access database how to get the  number of
rows
> in   table   like the sql statement is
>
> select * from  tablename;
>
> can i know how many   rows r there   (without moving all the rows )
>
> or   if i use  select count(*) from table   in the excutequery()  then
> what will be return
>
> or   can  we  get  the  no. of rows effected when i use "select..."
statement
> in excuteUpdate() function
>
>
> thanx in adcance
>
> paras
>
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to