PDA

View Full Version : adOpenForwardOnly or adOpenStatic?


codefox
01-11-2003, 05:08 AM
I generally use the adOpenStatic cursor in recordsets when I need the count of the records in the recordset. But they say using static cursors is inefficient. But if I use adOpenForwardOnly cursor, the recordcount property returns -1. Which cursor do you use when you need the recordcount of a recordset? Do you use adOpenForwardOnly and move through the whole recordset incrementing a variable for the recordcount or do you use adOpenStatic and use the recordcount property?

Thanks.

BigDaddy
01-11-2003, 07:24 AM
I'd have to be honest. Maybe I'm not as sphisticated a programmer as some guys but if I want the count, I execute a seperate query of select count(*)....

I don't specify any special cursor type.

oracleguy
01-11-2003, 11:21 PM
If you happen to be using an access database, http://www.asp101.com/samples/db_count.asp

If you are using msSQL or mySQL, just run this query:

"SELECT count(myfield) FROM mytable" and whatever you want after that.

And then when you wish to access the number you refer to the field as "count(myfield)".