[Gambas-user] metod record count

Arief Bayu Purwanto ariefbayu at ...626...
Wed Jan 16 08:52:40 CET 2008


On 1/16/08, gunartha.nyoman <gunartha.nyoman at ...1817...> wrote:
>
> Dear All,
>
> Hi all, could you like to help me.
> How to know a table have records or no using result metod
> (  'how to know rs have records or no
>    'when rs have records, show message "?? records found"
>    'else if no records, show message "no record found" )
>
> PRIVATE FUNCTION kon() AS Boolean
>
>   conn = NEW Connection
>   WITH conn
>   .Type = "postgresql"
>   .Host = "localhost"
>   .Login = "djs"
>   .Password = "djs"
>   .Name = "inventory"
>   END WITH
>
>   TRY conn.OPEN
>   IF ERROR THEN
>   Message("Cannot open database. Error = " & Error.Text)
>   RETURN FALSE
>   END IF
>   RETURN TRUE
>
> END
>
> PUBLIC SUB Button1_Click()
>
>   DIM strsql AS String
>   DIM rs AS Result
>
>    strsql = "select * from goods"
>    rs = conn.Exec(strsql)
>
>    'how to know rs have records or no
>    'when rs have records, show message "?? records found"
>    'else if no records, show message "no record found"
>
> END


First of all, have you ever read the documentation[1]?
you can use rs.Count[2].
Btw, I've give you this previously in your rs.EOF problem.

[1]http://www.gambasdoc.org/help/ of F1 in IDE
[2]http://www.gambasdoc.org/help/comp/gb.db/result/count


-- 
Arief Bayu Purwanto
About : http://about.freelancer.web.id/
Blog : http://bayu.freelancer.web.id/



More information about the User mailing list