johnlewe
asked on
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?
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?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.