RecordCount

They have: 32 posts

Joined: Jan 2001

OK I am having problems with RecordCount. I have used this before and it has worked fine.

rs.RecordCount ' returns number of records returned

This time I am getting -1.

I am retrieving Records.

Any Ideas?

Thanks!

Mike

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

RecordCount depends on the type of cursor you use, and where you open it (client or server). If I remember correctly all client side cursors support RecordSet, and server-side Dynamic & Forward only don't. So I'm guessing you're either not specifying the cursor or you're using one of these 2 server-side ones. Try changing your cursor.

PJ | Are we there yet?
pjboettcher.com

They have: 32 posts

Joined: Jan 2001

Thank you for your reply.

I tried changing the cursor and it produced the same results. When I entered this line of code it worked.

Is this necessary?

Thanks

Mike

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

That file is only necessary when you want to refer to the properties by name (adOpenDynamic) instead of the number (1,2,3, etc). That should not have any effect on whether or not .RecordCount works unless you hade some sort or error checking on (On Error Resume Next).

Instead of including that file (adovbs.inc) I just make reference to the actual ADO library on my server, I use this line in my global.asa:

PJ | Are we there yet?
pjboettcher.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.