I have a stored procedure that I need to know how many records were returned in the recordset. I have been reading up on the recordset.recordcount method, but everything seems to be for inline sql, not stored procedures. Any help is appreciated. Thanks.
Well, sorry to say, but that didn't help me. It looks like the recordcount method isn't very reliable. I tested your code on a stored proc that definately returns a recordset, and it gives me a value of -1. Also my stored procedure accepts two parameters....both integers.
If the provider does not support this property or the count cannot be done, a value of -1 will be returned.
The type of cursor being used by the Recordset affects whether this property can return a valid count. In general, you can obtain the actual count for a keyset and static cursor. However, you may get either a -1 or the count if a dynamic cursor is being used, and you cannot get a count if a forward-only cursor is being used (-1 is returned).
For forward only recordsets recordcount always returns -1. Your alternative is to use rs.open with a different cursorset (adcursorStatic or adCursorDynamic
perhaps).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.