Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Recordcount of a Server side query

Posted on 2006-03-27
3
Medium Priority
?
156 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?
0
Comment
Question by:johnlewe
  • 3
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 200 total points
ID: 16306627
SELECT COUNT(*) FROM [Products]

or
in your
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16306646
...
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
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16314627
Thanks for closing the question.

BFN,

fp.
[ http://www.justgiving.com/100RoundsOfSparring ]
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question