[Gambas-user] metod record count

Fabien Bodard gambas.fr at ...626...
Wed Jan 16 21:15:03 CET 2008


Le Wednesday 16 January 2008 05:17:52 gunartha.nyoman, vous avez écrit :
> 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
>
>
> Thank you for your help
> regards
> Gunartha
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

You have this sql method too


Print Db.Exec("SELECT count(*) FROM &1", sTable)["count(*)"]






More information about the User mailing list