Click to See Complete Forum and Search --> : recordcount returns -1 instead of numer of rows


pelegk1
11-21-2007, 11:17 AM
i am getting a recordset from a StoredProcedure
and when i try to check the line count i get -1
why is that?
thnaks in advnace
peleg

TheBearMay
11-21-2007, 12:07 PM
Off the top of my head, I think it means that you had no rows returned. I'll have to check to make sure though.

pelegk1
11-22-2007, 11:00 AM
i have rows for sure and i print them

TheBearMay
11-23-2007, 12:03 PM
Sounds like you may have a "forward only" cursor defined (see the ADO reference):


If objRecordset.Supports(adBookmark) Or objRecordset.Supports(adApproxPosition) Then
' RecordCount will work!
End If


Could always just get the same information using something like:

Select Count(*) from theTable

yearbass
11-25-2007, 11:06 AM
have you check your CursorLocation definition, is adUseClient employed ?

cn.CursorLocation = 3 ' adUseClient

or

rs.CursorLocation = 3 ' adUseClient