[ RB4] To test a cursor ?
Tim Davis
timdavis at amug.org
Fri Oct 24 00:19:07 CDT 2003
Hi Ruslan,
> You can write for example:
>
> if curs <> nil and curs.FirstRecord
> do
> ...
> while curs.NextRecord
> endif
Pardon me for saying, but I think RB has a problem with checking for a
nil cursor along with using the cursor. If the cursor was nil, it will
still continue and get a nil object exception error at FirstRecord.
(Though that's creative syntax, RB uses Do/Loop Until OR While/Wend.)
So the above would be:
if curs <> nil then
if curs.FirstRecord then
do
...
loop until not curs.NextRecord
end if
end if
> Or
>
> for I = 1 to curs.GetRecordCount()
> .....
> curs.NextRecord()
> next
if curs <> nil then
for i = 1 to curs.RecordCount
...
curs.NextRecord
next
end if
Is there any issue that might come up by ignoring the NextRecord
boolean and relying solely on the RecordCount?
Now we've covered all three REALbasic loops to cycle through cursor
records. : )
Thanks,
Tim Davis
More information about the Valentina
mailing list