Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Records not being returns....Help!

Status
Not open for further replies.

streborr

IS-IT--Management
Jan 16, 2002
98
I can't figure out why the records aren't being returned.

Here's the code:

The page sending the ID:

<%
sSQL = &quot;Select * from forums&quot;
Set oRS = oConn.Execute(sSQL)
thecount = &quot;0&quot;
%>
<table width=&quot;500&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>
<%
Do Until oRS.eof
%>
<tr>
<td><a href=&quot;forum.asp?ID=<%=oRS(&quot;ID&quot;)%>&quot;><%=oRS(&quot;ForumName&quot;)%></a>
</td>
</tr>
<%
thecount = thecount+1
oRS.moveNext
loop
%>
</table>

And the page receiving the ID: forum.asp

<%
dim ID
ID = Request(&quot;ID&quot;)

sSQL = &quot;Select * from forum Where (posttype = 'm') and (ForumID = ID)&quot;
Set oRS = oConn.Execute(sSQL)
thecount = &quot;0&quot;
response.write ID
%>
<table width=&quot;500&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;>

<%
Do Until oRS.eof
%>

<tr>
<td><a href=&quot;readmessage.asp?ID=<%=oRS(&quot;ID&quot;)%>&quot;><%=oRS(&quot;Title&quot;)%></a>
 <font size=&quot;-1&quot;><i>by <font color=&quot;#ff0000&quot;><%=oRS(&quot;Username&quot;)%></font>
 on <%=oRS(&quot;PostDate&quot;)%> at <%=oRS(&quot;PostTime&quot;)%></i></font></td>
</tr>

<%
thecount = thecount+1
oRS.moveNext
loop
%>

</table>

The response.write ID does display the right ID but no records are displayed. There are records, it just goes to the eof.

Thanks for any help!
Rick
 
Take ID out of the quotes:

(ForumID=&quot;&ID&&quot;)&quot;

Then you are using the local variable ID. Assuming ForumID is an int field I don't see how this could not be producing 'Invalid column name' errors. Unless you have a column named 'ID' :) Then I can see how it would parse correctly and not return you anything
 
Thanks yesti,

changing from (ForumID = ID)
to (ForumID = &quot;&ID&&quot;) did it!

Thanks for the quik response,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top