The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Anyone know how to make an SQL SELECT statement updateable by a form field entry? For example:
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.<
Code:
rsTopics.Source = "SELECT * FROM Topics WHERE TopicID = 365"
Posted
Thanks a lot for your time on that, cripto, it's very much appreciated! [^]
Is there an easy way to toggle between 2 connection strings on one page? For example; clicking a buttin to set the following connection string to one or the other:I think I may be doing this the hard way...
Or, run 2 queries on the same page? For example:I guess I'm asking how to run 2 different queries on the same connection (on the same page) so I don't have to duplicate everything... and will they work simultaniously?<
Is there an easy way to toggle between 2 connection strings on one page? For example; clicking a buttin to set the following connection string to one or the other:
Code:
rsComments.Source = "SELECT * FROM Comments WHERE Approved = False"
rsComments.Source = "SELECT * FROM Comments WHERE TopicID="& intTPIDOr, run 2 queries on the same page? For example:
Code:
rsComments.Source = "SELECT * FROM Comments WHERE "& Option1" OR "& Option2"
Option1 = Approved = False"
Option2 = TopicID="& intTPID
Last edited by Lon2 on 10 December 2008, 11:48
Posted
Take a look throughout the Snitz forum base code, and you will find many examples of what you want.
<
Posted
Ok, I got it working somewhat the way I need, and I think I saved a ton of work. Here's what I did:On the page I have a form field. When it's blank it shows Comments Not Approved (Approved = False) and when I enter a TopicID and submit it shows Topic Comments (TopicID="& intTPID). I just hit the submit button with a blank field to get back to Comments Not Approved.
Does anyone see any problems with the way I'm doing this?<
Code:
<%
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
%>Does anyone see any problems with the way I'm doing this?<
Last edited by Lon2 on 10 December 2008, 12:40
Posted
I guess not.
Thanks anyway!<
Thanks anyway!<
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...