[fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

Luca Olivetti luca at ventoso.org
Fri Oct 31 16:12:06 CET 2014


El 31/10/14 a les 12:13, Joost van der Sluis ha escrit:

>>
>> Well, if you "fix" the dbgrid not to use RecNo, I'm still left with my
>> original problem of knowing if I'm positioned at the first or the last
>> record (specifically for a TSdfDataset, where FCurRec is the correct
>> answer, and I still think it would be the correct value for RecNo).
> 
> With .eof and .bof? But those are not always set, you have to use 'next'
> or 'prior' to really know if you are at the first or last record.

Yes, I know it and I said so in my first message. What maybe I didn't
say is that I don't want to do either of those (which would make my code
more convoluted).
I happily (well, kinda) do it when there is no other option, but in this
case there is and I'd prefer to avoid:

1) getting a bookmark
2) disable the dataset/datasource events (to avoid an infinite loop)
3) try to use next and prior to determine if I'm at the beginning/end of
the table
4) go back to the current record
5) re-enable the events

when I can simply do a comparison based on RecNo/RecordCount


> (TSdfDataset is not buffered, but with a buffered dataset there really
> is no other way to detect the first or last record, since it could be
> that those records are simply not fetched yet)

I understand that, but my question is specific to TSdfDataset, where
FCurRec gives a meaningful answer to that question without the need of
scrolling.

Bye
-- 
Luca



More information about the fpc-pascal mailing list