rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = 365"
Originally posted by Lon2
Anyone know how to make an SQL SELECT statement updateable by a form field entry? For example:Code:I would like make the TopicID equals part (365) updateable by just typing the number in a form on an ASP page and clicking submit to update the page with the new TopicID number.rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = 365"
dim intTPID
intTPID=server.htmlencode(request.QueryString)
dim intTPID
intTPID=request.form("-----")
rsTopics.Source = "SELECT * FROM " & strActivePrefix & "Topics WHERE Topic_ID = " & intTPID
rsTopics.Source = "SELECT * FROM Topics WHERE TopicID =" & intTPID
and
dim intTPID
intTPID=request.form("ManualTopicID")
and
<form action="pend_topics.asp" method="post" name="ManualTopicID"><input type="text" size="10">
<input type="submit" name="Submit2" value="Submit">
</form>rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = 365rsTopics.Source = "SELECT * FROM Topics WHERE TopicID =" & intTPID
dim intTPID
intTPID=request.form("-----")
rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = " & intTPID
dim intTPID
intTPID=server.htmlencode(request.QueryString)<html>
<body>
<form action="test.asp" method="post">
Enter Topic_ID Here: <input type="text" name="topicid" size="10">
<input type="submit" value="Submit!">
</form>
<%
Dim TopicID
TopicID = Request.Form("topicid")
if trim(TopicID) <> "" and isNumeric(TopicID) = true then 'make sure TopicID is not empty and is a number
Response.Write "TopicID = " & TopicID & " - use it as you want"
else
if trim(TopicID) = "" then
Response.Write "TopicID is empty"
else
Response.Write TopicID & " is not numeric"
end if
end if
%>
</body>
</html> rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = " & intTPIDdim intTPID
intTPID = Request.Form("ManTopicID")<form action="pend_topics.asp" method="post" name="form5">
Enter Topic ID Here: <input name="ManTopicID" type="text">
<input type="submit" value="Go">
</form>if trim(intTPID) <> "" and isNumeric(intTPID) = true then
'Query code here
else
Response.Write "Error - unable to query db intTPID has an invalid value"
end if<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="top.asp"-->
<!--#include file="connTopics.asp" -->
<%
dim intTPID
intTPID = Request.Form("ManTopicID")
%>
<%
set rsCommentsAppr = Server.CreateObject("ADODB.Recordset")
rsCommentsAppr.ActiveConnection = connTopics_STRING
rsCommentsAppr.Source = "SELECT * FROM Comments WHERE TopicID="& intTPID
rsCommentsAppr.CursorType = 0
rsCommentsAppr.CursorLocation = 2
rsCommentsAppr.LockType = 3
rsCommentsAppr.Open()
rsCommentsAppr_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsCommentsAppr_numRows = rsCommentsAppr_numRows + Repeat1__numRows
%>
<%
Dim HLooper1__numRows
HLooper1__numRows = 30
Dim HLooper1__index
HLooper1__index = 0
rsCommentsAppr_numRows = rsCommentsAppr_numRows + HLooper1__numRows
%>
<%
If Not
rsCommentsAppr.EOF
Or Not
rsCommentsAppr.BOF
Then
%>
<%
While ((Repeat1__numRows <> 0)
AND (NOT rsCommentsAppr.EOF))
%>
<form action="pend_topics.asp" method="post" name="form5">
Enter Topic ID Here: <input name="ManTopicID" type="text">
<input type="submit" value="Go">
</form>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsCommentsAppr.MoveNext()
Wend
%>
<%
End If
%>
<%
If rsCommentsAppr.EOF
And rsCommentsAppr.BOF
Then
%>
There are no Comments for this topic
<%
End If
%>
<!--#include virtual="/footer.asp"-->
<%
rsCommentsAppr.Close()
%>
<%
Set rsCommentsAppr = Nothing
%><%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="top.asp"-->
<!--#include file="connTopics.asp" -->
<%
dim intTPID
intTPID = Request.Form("ManTopicID")
if trim(intTPID) <> "" and isNumeric(intTPID) = true then
set rsCommentsAppr = Server.CreateObject("ADODB.Recordset")
rsCommentsAppr.ActiveConnection = connTopics_STRING
rsCommentsAppr.Source = "SELECT * FROM Comments WHERE TopicID="& intTPID
rsCommentsAppr.CursorType = 0
rsCommentsAppr.CursorLocation = 2
rsCommentsAppr.LockType = 3
rsCommentsAppr.Open()
'rsCommentsAppr_numRows = 0
'Dim Repeat1__numRows
'Repeat1__numRows = -1
'Dim Repeat1__index
'Repeat1__index = 0
'rsCommentsAppr_numRows = rsCommentsAppr_numRows + Repeat1__numRows
'Dim HLooper1__numRows
'HLooper1__numRows = 30
'Dim HLooper1__index
'HLooper1__index = 0
'rsCommentsAppr_numRows = rsCommentsAppr_numRows + HLooper1__numRows
If Not rsCommentsAppr.EOF Or Not rsCommentsAppr.BOF Then
'While ((Repeat1__numRows <> 0) AND (NOT rsCommentsAppr.EOF))
Response.Write "<table border=""1px"">"
While rsCommentsAppr.EOF = false
'Repeat1__index=Repeat1__index+1
'Repeat1__numRows=Repeat1__numRows-1
Response.Write "<tr>"
for each x in rsCommentsAppr.Fields
Response.Write "<td>" & x.value & "</td>"
next
Response.Write "</tr>"
rsCommentsAppr.MoveNext()
Wend
Response.Write "</table>"
ELSe
Response.Write "There are no Comments for this topic"
End If
rsCommentsAppr.Close
Set rsCommentsAppr = Nothing
End If
%>
<form action="pend_topics.asp" method="post" name="form5">
Enter Topic ID Here: <input name="ManTopicID" type="text">
<input type="submit" value="Go">
</form>
<!--#include virtual="/footer.asp"-->
rsComments.Source = "SELECT * FROM Comments WHERE Approved = False"
rsComments.Source = "SELECT * FROM Comments WHERE TopicID="& intTPIDrsComments.Source = "SELECT * FROM Comments WHERE "& Option1" OR "& Option2"
Option1 = Approved = False"
Option2 = TopicID="& intTPID<%
dim intTPID
intTPID = Request.Form("ManImgID")
set rsComments = Server.CreateObject("ADODB.Recordset")
rsComments.ActiveConnection = MM_connImageGallery_STRING
if trim(intTPID) <> "" and isNumeric(intTPID) = true then
rsComments.Source = "SELECT * FROM Comments WHERE TopicID="& intTPID
else
rsComments.Source = "SELECT * FROM Comments WHERE Approved = False"
end if
rsComments.CursorType = 0
rsComments.CursorLocation = 2
rsComments.LockType = 3
rsComments.Open()
rsComments_numRows = 0
%>