Recordcount of a Server side query

Hello All,

I am using ADO and VB 6. I am running a query to return all the records in a table:

Select * from Products

I have set the .CursorLocation = adServer so that the results do not consume the local machines memory.

I really need to know how many records are in the table.  The .recordCount property returns -1 (since it is a server side query). I was thinking there must be a sql query I could run to determine how many records are in the table.

Like for example "SELECT COUNT(??) of Products" or something similiar where "??" is a field name or something.  Any ideas?

I guess bottom line is there a SQL query that will return the number of records in the table?
johnleweAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
SELECT COUNT(*) FROM [Products]

or
in your
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
[ fanpages ]IT Services ConsultantCommented:
...
or
in your table, select one column, say, [Name]:

SELECT COUNT([Name]) From [Products]

Also, in ADO code:

objRecordset.MoveFirst
objRecordset.MoveLast

Then query objRecordset.RecordCount

BFN,

fp.
0
[ fanpages ]IT Services ConsultantCommented:
Thanks for closing the question.

BFN,

fp.
[ http://www.justgiving.com/100RoundsOfSparring ]
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.