|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ?? |
|
#2
|
||||
|
||||
|
Quote:
Post your query here; Are you using sql server?
__________________
I would rather know than not know at all... ![]() |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Diffrent option
Quote:
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... |
|
#5
|
||||
|
||||
|
your syntax was all wrong.
try this instead: Code:
sql = "SELECT Count(hostname) AS HostCount FROM tbl_Host"
...
response.write(rs("HostCount"))
|
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > ASP count record help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|