[Gambas-user] metod record count
nando
nando_f at ...951...
Wed Jan 16 20:15:55 CET 2008
Something like...(and read the help as suggested)
PUBLIC SUB Button1_Click()
DIM strsql AS String
DIM rs AS Result
strsql = "select * from goods"
rs = conn.Exec(strsql)
IF rs.count=0 THEN
PRINT "NO RECORDS"
ELSE
PRINT "Records Found: " & rs.count
ENDIF
END
-Fernando
---------- Original Message -----------
From: "Arief Bayu Purwanto" <ariefbayu at ...626...>
To: gunartha.nyoman at ...1817..., "mailing list for gambas users"
<gambas-user at lists.sourceforge.net>
Sent: Wed, 16 Jan 2008 14:52:40 +0700
Subject: Re: [Gambas-user] metod record count
> 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/
> -------------------------------------------------------------------------
> 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
------- End of Original Message -------
More information about the User
mailing list