Thread: ResultSet....

ResultSet....

From
"Robson Martins"
Date:
Hello all, i want to make a select count(*) and set a variable with this value i''m using the command:
   rs = st.executeQuery("select count(*) from imoveis where imo_situ = 'venda' and imo_tipo = 'kiti'");
   total = rs;
But this doesnt work!
How do i do what i want?
I use Postgresql 6.5 and everything is working right (database connection), i only want to know how do i do this!
Help me..
Hugs...Robson

Re: [INTERFACES] ResultSet....

From
Constantin Teodorescu
Date:
First of all :

PLEASE, FIND A GOOD JAVA BOOK AND LEARN JAVA AND JDBC!
Also, download JDBC documentation from Sun and read it!
You will find all the information you need and even some examples.
This list is * NOT * intented to be used for Java (JDBC) training.

> Robson Martins wrote:
> 
> Hello all, i want to make a select count(*) and set a variable with
> this value i''m using the command:
>    rs = st.executeQuery("select count(*) from imoveis where imo_situ =
> 'venda' and imo_tipo = 'kiti'");
>    total = rs;
> But this doesnt work!

Try total = rs.getInt(1);

Best regards,
-- 
Constantin Teodorescu
FLEX Consulting Braila, ROMANIA


Re: [INTERFACES] ResultSet....

From
PostgreSQL
Date:

On Wed, 21 Jul 1999, Robson Martins wrote:

> Hello all, i want to make a select count(*) and set a variable with this value i''m using the command:
>    rs = st.executeQuery("select count(*) from imoveis where imo_situ = 'venda' and imo_tipo = 'kiti'");
>    total = rs;
> But this doesnt work!
> How do i do what i want?
> I use Postgresql 6.5 and everything is working right (database connection), i only want to know how do i do this!
> Help me..
> Hugs...Robson
> 



Hi there




total = rs.getInt("count");


Leonel Nunez