kasper
10-24-2003, 03:04 AM
Hi there!
I've got a problem with SQL and an If case....
SQL = "SELECT PageID,COUNT(*) AS antal FROM tblHits WHERE Datum= " & Hour(Time) & " AND Datum = '" & FormatDateTime(Now, 2) & "' GROUP BY PageID ORDER BY PageID"
Set RS = Conn.Execute(SQL)
antal = CLng(RS("antal"))
If antal < 1 THEN
Response.Write "No hits last hour<br>"
ELSE
Response.Write"<td><b>Hits last hour " & (RS("antal"))& "</b><br></td></tr></table>"
End If
The datatype for Datum is DateTime..in the SQL db.
As long as there are values stored in the db it works alright but as soon as there are no values it gets wrong an the message I get is that the variabel is wrong..
Got any suggestions ...how to get it to work...?
Thanx!:)
I've got a problem with SQL and an If case....
SQL = "SELECT PageID,COUNT(*) AS antal FROM tblHits WHERE Datum= " & Hour(Time) & " AND Datum = '" & FormatDateTime(Now, 2) & "' GROUP BY PageID ORDER BY PageID"
Set RS = Conn.Execute(SQL)
antal = CLng(RS("antal"))
If antal < 1 THEN
Response.Write "No hits last hour<br>"
ELSE
Response.Write"<td><b>Hits last hour " & (RS("antal"))& "</b><br></td></tr></table>"
End If
The datatype for Datum is DateTime..in the SQL db.
As long as there are values stored in the db it works alright but as soon as there are no values it gets wrong an the message I get is that the variabel is wrong..
Got any suggestions ...how to get it to work...?
Thanx!:)