June 21, 2002 at 3:05 am
Hi
If I have a recordset that executes a stored proc via a command object, by default its RecordCount property is set to -1, how can I get the actual count.
I've tried changing the CursorLocation property of the recordset object to no avail.
How can I get then number of records returned without having to loop through.
June 21, 2002 at 4:32 am
Im confused - a proc that returns a recordset or you're looping through a recordset executing a proc for each row? In any case the simplest way I know is to us an output parameter and return the value of @@Rowcount.
Andy
June 21, 2002 at 4:50 am
adOpenStatic and adOpenKeyset should help.
The ADO Recordcount property help states
"Use the RecordCount property to find out how many records are in a Recordset
object. The property returns -1 when ADO cannot determine the number of
records or if the provider or cursor type does not support RecordCount.
Reading the RecordCount property on a closed Recordset causes an error.
If the Recordset object supports approximate positioning or bookmarks-that
is, Supports (adApproxPosition) or Supports (adBookmark), respectively,
return True-this value will be the exact number of records in the Recordset,
regardless of whether it has been fully populated. If the Recordset object
does not support approximate positioning, this property may be a significant
drain on resources because all records will have to be retrieved and counted
to return an accurate RecordCount value.
The cursor type of the Recordset object affects whether the number of
records can be determined. The RecordCount property will return -1 for a
forward-only cursor; the actual count for a static or keyset cursor; and
either -1 or the actual count for a dynamic cursor, depending on the data
source."
I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961
I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply