[Gambas-user] database eof and bof
Rob
sourceforge-raindog2 at ...94...
Sun Mar 6 07:20:25 CET 2005
On Sunday 06 March 2005 00:58, Neil Fallon wrote:
> Hi,
>
> I have searched the archive and checked the documentation but can't
> seem to find an answer. Does Gambas support EOF and BOF when
> working with databases? In VB you would write something like
>
> If rsResult.EOF = True Then
> do something
> Else
> do something else
> End If
>
>
> If it doesn't support EOF and BOF what is the suggested way of
> trapping the beginning and end of a database if the items aren't
> loaded into a list or combobox?
EOF and BOF are merged into one property, "Available". r.Available in
Gambas is like "not r.EOF" in VB.
(r as Result, as I usually do)
r.MoveNext
If r.Available Then
' gimme some data
Else
' close the DB
End If
I agree that this should be documented better or mentioned in the
DifferencesFromVB page. Here is the page on Available:
http://www.binara.com/gambas-wiki/bin/view/Gambas/GbDbResult
Note that when you're iterating through a whole recordset, rather than
doing the Do...Loop thing, in Gambas it's easier to use For
Each...Next thing.
FOR EACH r
' gimme some data
NEXT
No BOF, EOF or Available required. Of course if you're moving forward
and backward at the whims of a user, you're stuck checking
r.Available.
Rov
More information about the User
mailing list