Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with SQL statement, perhaps?

0 views
Skip to first unread message

Brint Hite

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to

I have a table in my database called Forums with a ForumID column, which is
an AutoNumber value. One record in this table has a ForumID value of 78.
In the following code, where ForumToShow = 78 , why doesn't it return the
ForumID and Subject values of the record with a ForumID of 78? The
ForumToShow value is a variable in the page's URL (/forum.asp?id=78). I
think the problem lies somewhere within my SQL statement. Any ideas?

> <%
> ForumToShow = CStr(Request("id"))
>
> ' Opens database
> set conn = server.createobject("ADODB.Connection")
> conn.open "AR"
> ' Creates recordset
> set rs = Server.CreateObject("ADODB.RecordSet")
> SQL = "SELECT * FROM Forums WHERE CStr(ForumID) = 'ForumToShow'"
> rs.Open SQL, conn
> do until rs.EOF = true
> response.write rs("ForumID") & "<br>"
> response.write rs("Subject")
rs.movenext
> loop
> conn.close
> set conn = Nothing
> set rs = Nothing
> set ForumToShow = Nothing
> %>

Thanks,
Brint Hite


Anthony Sullivan MCP

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to
Not sure but you might try this.

SQL = "SELECT * FROM Forums WHERE" & CStr(ForumID) & " = 'ForumToShow'"

Anthony Sullivan MCP, GMT, GST
Analyst/Programmer
Ajilon Services, Inc
LG&E

Brint Hite wrote in message ...

0 new messages