-
can somebody tell me what is wrong with this code.. i am trying to get the count..
Dim rsMessages2
Set rsMessages2 = DB.Execute ("SELECT count(*) FROM Messages WHERE ForumID = " & ForumID)
Response.Write rsMessages2
the error is on the "Response.Write rsMessages2"
thanks
ren
-
Try this:
<%
Dim rstCount
Set rstCount = cnnDb.Execute("SELECT COUNT(*) FROM Messages WHERE ForumId=" & lngForumId & ";")
Response.Write rstCount(0)
%>
.. should work.
-
Or you could change this:
Response.Write rsMessages2
to say this:
Response.Write rsMessages2 & "_<BR>"
That might help, .....
-
See if this will work as well. Your problem is that you are trying to write the Recordset Object, not a string.
Code:
Dim rsMessages2
Set rsMessages2 = DB.Execute ("SELECT count(*) AS MyCount FROM Messages WHERE ForumID = " & ForumID)
Response.Write rsMessages2.Fields("MyCount")