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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Criteria Form 1

Status
Not open for further replies.

OrWolf

MIS
Mar 19, 2001
291
Can anyone suggest a good article on using forms for users to update SQL criteria? I have the SQL statement down and a form with fields for the user to enter new information, however I can't figure out how to pass the information they enter into a session variable or query string.

Thanks
 
Are you trying to pass the form variables into the SQL query? Not sure I understand exactly what you're looking for, but let me see if I can give an idea of something I've done and see if it matches up to what you're looking for.

Create the beginning part of your SQL statement:

<%
strSQL = &quot;SELECT field1, field2, field3 FROM table1 WHERE &quot;

then further down:

strSQL = strSQL & &quot;field1 = &quot; & variable1

Obviously, you can adapt to your needs, but see if this is what you need. If not, let me know and I'll see if I can help. I'm no expert with ASP, but found this to work for me. Good luck.
 
That piece of the puzzle I have. My problem is that I have a form with text boxes where a user can enter data. Upon hitting a button I want the form to refresh and use the information entered in the text box in the SQL statement.

My problem is saving the value the enter in the textbox and using it when the same form is refreshed.
 
Still not totally sure that I follow what you're trying to do. If you're trying to pull information that the user entered in the form previously, could you not simply change it to:

strSQL = strSQL & &quot;field1 = &quot; & request.form(&quot;variable1&quot;)

? Or maybe it's something to do with the form refresh? Maybe if you post your code it might be easier to understand (at least for me).
 
I want to retrieve the users entries from the same form and use them on the refresh. You have given me an idea though. I can call a second form, set the variables, then redirect back to the initial form.

If there is a better way, please let me know. Otherwise, thanks!
 
That would be one way. The other possibility is iterating through the form's fields and saving them in the refresh using hidden values (if I'm understanding what you're looking for). Not sure if that would be easier, though. Hopefully you've got the right idea. Sorry I wasn't better help, but good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top