Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting Values in a Recordset
Message
From
31/03/2001 11:24:20
 
 
To
28/03/2001 10:17:09
Todd Wolfe
Certified Marketing Services
Kinderhook, New York, United States
General information
Forum:
Internet
Category:
Active Server Page
Miscellaneous
Thread ID:
00489424
Message ID:
00490602
Views:
9
Hi Todd, here is a solution:
Dim rsForCount, cnnExisting
Set rsForCount = Server.CreateObject( "ADODB.Recordset")
' we will use your existing connection
Set cnnExisting = rsYourExistingRecorset.ActiveConnection
rsForCount.CursorLocation = 3                ' adUseClient, to be able to disconnect recorset
rsForCount.Open "Select COUNT(*) As Count From TableName Where WhereClause", cnnExisting
Set rsForCount.ActiveConnection = Nothing    ' get a disconnected recordset
myField = rsForCount.Fields( "Count").Value
Set rsForCount = Nothing
The same thing you may use to SUM field values and so on.

With best regards,
Alex


>With fox pro working with tables allows the utilization of a count statement to found out how many of something ='s a certain value. Such as this statment
>
>count for myfield='X' to m.myfield
>
>I am working with ASP currently and connecting to fox pro table using odbc. Is there a way to count a field name = to a certain value like above in my recordset created with ADO? I am going to have several fields that need totaing in my recordset and I would prefer not to use a loop for efficiency purposes.
>
>
>Thanks in advace.
Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform