# Asp. using a db object inside of a db string?

**URL:** <https://forum.kirupa.com/t/asp-using-a-db-object-inside-of-a-db-string/143890>\
**Category:** Uncategorized\
**Created:** [April 9, 2005, 6:27pm UTC](https://forum.kirupa.com/t/asp-using-a-db-object-inside-of-a-db-string/143890 "2005-04-09T18:27:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imported\_dinkumrocks](https://avatars.discourse-cdn.com/v4/letter/i/58f4c7/32.png) [@imported\_dinkumrocks](https://forum.kirupa.com/u/imported_dinkumrocks)\
**Post date:** [April 9, 2005, 6:27pm UTC](https://forum.kirupa.com/t/asp-using-a-db-object-inside-of-a-db-string/143890/1 "2005-04-09T18:27:58Z")

</div>

OK. ive made this whole application. im now at the point where ive finished the comments on news articles.

but i want to show how many comments there are on that article on the mian page.

this is waht i have…

```auto
 
<%
set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "SELECT TOP 3 * FROM updates ORDER BY item_when DESC", Conn
If Not(RS.EOF) then 
RS.MoveFirst()
 %>
<div class="asset"><strong><span class="newstitle"><%= RS("item_title")%></span></strong><br><br><strong><%= RS("item_when")%> - by </strong><%= RS("item_user")%><br><br><%= RS("item_body")%> <br><br>
  <a href="community/news_comment.asp?storyid=<%= RS("id")%>">Comments</a>(<% commstoryid = RS("id")
  set countrecs = Server.CreateObject("ADODB.Recordset")
  countrecs.Open "SELECT from comments where storyid=" & commstoryid & "", Conn, 1, 1
  Response.Write "" & countrecs.recordcount & ""
  countrecs.close%>)</div> 
' then the rest of the code.

```

ive tried…

```auto
 ...
 countrecs.Open "SELECT from comments where storyid=" & RS("id") & "", Conn, 1, 1

```

but it didnt work.

any help?  
-Naaman
