mosheshitrit
asked on
Rs.CursorLocation
Hi everyone,
When i use CursorLocation adUseClient on opening of a table with large ammount of records, the opening is very very slow.
on the other hand, when i use CursorLocation adUseServer,
i get -1 value on the RecordCount and AbsolutePosition properties.
How can i know the RecordCount and AbsolutePosition properties on CursorLocation adUseServer ?
10x
When i use CursorLocation adUseClient on opening of a table with large ammount of records, the opening is very very slow.
on the other hand, when i use CursorLocation adUseServer,
i get -1 value on the RecordCount and AbsolutePosition properties.
How can i know the RecordCount and AbsolutePosition properties on CursorLocation adUseServer ?
10x
Before you check the recordcount do a Movelast then the recordcount will be populated
ASKER
To Hes:
10x but the movelast action does not help
10x but the movelast action does not help
ASKER
to mdougan:
Thanks for the explanation.
I can't use the RS.AbsolutePosition property because it returns -1 value
Thanks for the explanation.
I can't use the RS.AbsolutePosition property because it returns -1 value
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To mdougan:
Thanks for the quick solution.
Use CursorLocation adUseServer with cursorType
adKeyset and you will see both the RecordCount and AbsolutePosition properties.
Thanks for the quick solution.
Use CursorLocation adUseServer with cursorType
adKeyset and you will see both the RecordCount and AbsolutePosition properties.
A "server-side" cursor simply has to open up and return you one buffer's worth of data. However, since not all rows have been returned to the cursor, it doesn't yet know how many records there are. So, the only way you can get an accurate record count is to read to the end of the cursor, and then, perhaps, the recordcount will reflect the number of records, or, you can look a the RS.AbsolutePosition property.
However, in reading to the end of the "server-side" cursor, you've just lost your performance advantage.
If you absolutely need the count at the beginning of returning records, but you absolutely want to use a server-side cursor, then you might consider issuing the same SQL Statement except instead of selecting columns, do a Select Count(*) from ..... get the count first, and then issue the normal select statement....