We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Recordcount of a Server side query

johnlewe
johnlewe asked
on
Medium Priority
171 Views
Last Modified: 2010-05-01
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?
Comment
Watch Question

Consultant (Development Team Lead, Senior Support Engineer, and Technical Test Leader)
CERTIFIED EXPERT
Commented:
SELECT COUNT(*) FROM [Products]

or
in your

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
[ fanpages ]Consultant (Development Team Lead, Senior Support Engineer, and Technical Test Leader)
CERTIFIED EXPERT

Commented:
...
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.
[ fanpages ]Consultant (Development Team Lead, Senior Support Engineer, and Technical Test Leader)
CERTIFIED EXPERT

Commented:
Thanks for closing the question.

BFN,

fp.
[ http://www.justgiving.com/100RoundsOfSparring ]
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.