Using Select Count in ASP 
Author Message
 Using Select Count in ASP

I'm having trouble determining the recordset object name in the
following code:
---
set conn = server.createobject ("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath &
";"
Set rstNumLines = conn.execute("select Count(OrderLineID) as NumLines" _
        & " from OrderItems " _
        & " where OrderItems.OrderNumber = " & lngOrderNumber _
        & " and OrderItems.OrderLineStatus = 'OPEN'")

For Each Field in rstNumLines.Fields
        response.write rstNumLines(Field.Name) & "<BR>"
Next
response.end
---

I'm expecting the recordset  rstNumLines to contain an object named
NumLines because of the syntax "as Numlines" which Iadded to the select
count statement. Instead, I get a number that represents the count
returned. It's a moving target. Any Ideas?

TIA.

Kevin Struckhoff

*** Sent via Developersdex http://www.***.com/ ***
Don't just participate in USENET...get rewarded for it!



Wed, 21 Jul 2004 13:33:07 GMT
 Using Select Count in ASP

Kevin, I haven't tried this, but what happens if you modify the
response.write as shown below:

response.write Field.Name & "<BR>"
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/


I'm having trouble determining the recordset object name in the
following code:
---
set conn = server.createobject ("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath &
";"
Set rstNumLines = conn.execute("select Count(OrderLineID) as NumLines" _
& " from OrderItems " _
& " where OrderItems.OrderNumber = " & lngOrderNumber _
& " and OrderItems.OrderLineStatus = 'OPEN'")

For Each Field in rstNumLines.Fields
response.write rstNumLines(Field.Name) & "<BR>"
Next
response.end
---

I'm expecting the recordset  rstNumLines to contain an object named
NumLines because of the syntax "as Numlines" which Iadded to the select
count statement. Instead, I get a number that represents the count
returned. It's a moving target. Any Ideas?

TIA.

Kevin Struckhoff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 21 Jul 2004 18:03:20 GMT
 Using Select Count in ASP

Thanks, my bad.

Kevin Struckhoff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Thu, 22 Jul 2004 13:32:38 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. using SELECT COUNT(*) to count distinct records

2. Re select count(1) vs select count(*)

3. SELECT COUNT(*) or SELECT COUNT(id)

4. select count(1) vs select count(*)

5. select count(*) and ASP

6. Using count calling from ASP

7. make SELECT COUNT(*) speedy using stats

8. counting rows returned on select using DBI

9. update value using select COUNT(*) from another table

10. Need help with multiple SELECT using multiple COUNTs

11. Error using count(*) with UNSION SELECT on OS/390 v6

12. Using SQL SELECT to count certain records


 
Powered by phpBB® Forum Software