Hello,
i have a problem when i am navigating through a IBCTable or IBCQuery result.
For example: I have a table with four entries. After Activating the table by setting active property to true, i start with the first record. I have a button called next, which uses the Next() method. Thereafter i am checking, if EOF is true to disable the next button. But the following happens:
I go from the third to the fourth entry with Next. The fourth entry is the last one. But EOF still give me false retour. By using Next again EOF is true, but i am still at the end of the table.
The same is with BOF, getting true after reaching the first entry and using Prior.
Using DBNavigator component gives me the same behaviour.
My workaroung is to get the numbers of records and doing the navigation with comparing the position with the records number.
Does anybody have an idea to solv these problems?
Regards,
Firedbird-Hunter
Problem with EOF or BOF
It is standard behaviour of EOF and BOF properties. EOF is set to True by Next method when it failed to get the next record.
When you come to the last record, and FetchAll property is False, the component not always knows if there are subsequent records. When you call Next method again, the component tries to fetch next block of records, and sets EOF, if there are no more records.
When you come to the last record, and FetchAll property is False, the component not always knows if there are subsequent records. When you call Next method again, the component tries to fetch next block of records, and sets EOF, if there are no more records.
-
- Posts: 9
- Joined: Tue 18 Mar 2008 18:47
Dear Plash
thanks for your information. Ok, so i have to find another way doing the navigation.
For this purpose i want to get the record count. Do i get the right record count when i activating a table / query and do a First() and Last() just behind? Of course i would use only a simple query to reduce workload on the server.
With regards
Firebird_Hunter
thanks for your information. Ok, so i have to find another way doing the navigation.
For this purpose i want to get the record count. Do i get the right record count when i activating a table / query and do a First() and Last() just behind? Of course i would use only a simple query to reduce workload on the server.
With regards
Firebird_Hunter
You can get right record count, if you call Last method, and then read RecordCount property. You can also set FetchAll property to True. In this case you don't need to call Last method.
If you table contains a large amount of records, you can set Options.QueryRecCount property to True, and FetchAll to False. TOraQuery component will execute additional query 'SELECT COUNT() FROM ...' on openning to get record count. So RecordCount property contains correct value, and you do not need to call Last method.
If you table contains a large amount of records, you can set Options.QueryRecCount property to True, and FetchAll to False. TOraQuery component will execute additional query 'SELECT COUNT() FROM ...' on openning to get record count. So RecordCount property contains correct value, and you do not need to call Last method.
-
- Posts: 9
- Joined: Tue 18 Mar 2008 18:47