Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 4th, 2007, 12:14 PM
lostplastic lostplastic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 11 lostplastic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 3 m 48 sec
Reputation Power: 0
ASP count record help

in my SELECT statment I use a Count, and no matter how I write it I only get a result of 1 ?


Count(tbl_Host.hostname) AS [Quant Host]

response.write Quant Host

results = 1

Any ideas why ??

Reply With Quote
  #2  
Old January 5th, 2007, 08:15 AM
chapman10s's Avatar
chapman10s chapman10s is offline
**Wanted Wizard**
ASP Free God (5000 - 5499 posts)
 
Join Date: Apr 2006
Location: Who knows...
Posts: 5,407 chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 12139 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 4 Days 11 h 36 m 30 sec
Reputation Power: 1331
Send a message via AIM to chapman10s Send a message via MSN to chapman10s
Quote:
Originally Posted by lostplastic
in my SELECT statment I use a Count, and no matter how I write it I only get a result of 1 ?


Count(tbl_Host.hostname) AS [Quant Host]

response.write Quant Host

results = 1

Any ideas why ??


Post your query here;
Are you using sql server?
__________________
I would rather know than not know at all...



Reply With Quote
  #3  
Old January 5th, 2007, 09:31 AM
asmoran asmoran is offline
ASPFree Know-It-All
ASP Free Novice (500 - 999 posts)
 
Join Date: Aug 2004
Posts: 930 asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level)asmoran User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 15 h 22 m 12 sec
Reputation Power: 325
Try Count(1) and see if you still only get 1.

Count(1) will count all records returned. Count(fieldname) will count all records that do not contain a null value for that field. A slight, but important, difference.

Reply With Quote
  #4  
Old January 5th, 2007, 12:30 PM
lostplastic lostplastic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 11 lostplastic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 3 m 48 sec
Reputation Power: 0
Diffrent option

Quote:
Originally Posted by asmoran
Try Count(1) and see if you still only get 1.

Count(1) will count all records returned. Count(fieldname) will count all records that do not contain a null value for that field. A slight, but important, difference.


I have an ACCESS DB.
And no matter what I did the results was still 1
Code:
sql = "SELECT Count(tbl_Host.hostname) AS [Quant Host]"

response.write(rs.Fields("Quant Active").Value) 

NO matter what the RESULTS = 1



So I did a count of the records this way

Code:
    lobNM = ""
 
Do While Not rs.EOF 
    if lobNM <> rs.Fields("lob_name") and lobNM <> "" then
        lobCNT = 0
        lobNM = rs.Fields("lob_name")
    end if

	lobCNT = lobCNT + 1  
  	response.write lobCNT

	rs.MoveNext
Loop

Thanks for trying to help I just took a LONG cut I guess...

Reply With Quote
  #5  
Old January 7th, 2007, 09:33 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,969 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342274 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 15 h 9 m 16 sec
Reputation Power: 1556
your syntax was all wrong.
try this instead:
Code:
sql = "SELECT Count(hostname) AS HostCount FROM tbl_Host"
...
response.write(rs("HostCount"))

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > ASP count record help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway