I'm sorry, I don't know if I 100% understand you. You have a table with a collection of products and comments and you want to get a count for how many comments were made for a certain product? I'm assuming that if you have a link www.mydomain.com/comments.asp?product=55 that you would only see the comment for product 55?
If so, there are a couple of ways to approach this:
1) Do it in an SQL statement:
<%
strSQL = Select count(*) as recordcount from product_table where ProdID = " & request("Product")
set rs = my_Conn.Execute (strSql)
RecordCount = rs("RecordCount")
rs.close
rs = nothing
Response.Write "# records = " & RecordCount
%>
2) Use the SQL to select all the values you want, then use the recordcount property:
<%
strSQL = Select comment, name from product_table where ProdID = " & request("Product")
rs.open strSql, my_Conn, 3
if rs.eof or rs.bof then
' no records found....
recordcount = 0
else
RecordCount = rs.RecordCount
do until rs.eof
:
: do other work here....
:
rs.movenext
loop
end if
rs.close
rs = nothing
Response.Write "# records = " & RecordCount
%>
3) Use the SQL to select all the values you want, then count the record manually:
<%
strSQL = Select comment, name from product_table where ProdID = " & request("Product")
rs.open strSql, my_Conn, 3
recordcount = 0
if rs.eof or rs.bof then
' no records, do nothing...
else
do until rs.eof
:
: do other work here....
:
RecordCount = RecordCount + 1
rs.movenext
loop
end if
rs.close
rs = nothing
Response.Write "# records = " & RecordCount
%>
Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead