Forums
This topic is locked
Pass Request.Form variabel to SQL select statement
Posted 25 Apr 2002 23:20:43
1
has voted
25 Apr 2002 23:20:43 Harry Toews posted:
I have passed variables using the Request.Form() in the past - declared the variable in the Recordset Builder (varThisVariable - Value % - Request.Form("ThisVariable") ... etc.However, when I try this using the Request.Form() to pass a variable to the actual database table select (SELECT * FROM varThisVariable ... etc.) it bombs every time.
Example:
SELECT * FROM varThisVariable
ORDER BY Field ASC
(where varThisVariable is a Request.Form())
I've tried to get around this in numerous ways with no luck. There also seem to be issues with the "Default" variable. It can't be "%" .... or any name other than that of a table contained in the database itself.
Can a variable like this not be passed to stipulate the actual table ... rather than just parameters for columns within the table??? .... or am I missing something obvious here.
Thanks for any comments ... ideas ... suggestions..<b></b><b></b>
Replies
Replied 07 May 2002 22:18:56
07 May 2002 22:18:56 josh padilla replied:
Try this:
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
request.form("state"
##Don't forget you also need an html form
##using the POST method with "state"
I need a repository or reference of ultradev code and libraries, all text based.
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
request.form("state"
##Don't forget you also need an html form
##using the POST method with "state"
I need a repository or reference of ultradev code and libraries, all text based.
Replied 07 May 2002 22:26:14
07 May 2002 22:26:14 josh padilla replied:
Oops, I forgot something:
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
varState comesfromform
request.form("state"
This should work better.
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
varState comesfromform
request.form("state"
This should work better.
Replied 07 May 2002 22:28:45
07 May 2002 22:28:45 Harry Toews replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Try this:
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
request.form("state"
##Don't forget you also need an html form
##using the POST method with "state"
I need a repository or reference of ultradev code and libraries, all text based.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thank you for the reply .... but I am actually trying to pass a Variable for the "TableName" through the request.form("variable" from a Select list on the previous page.
So the select statement would be:
SELECT * FROM [variable picked up from request.form() to be the table name]
ORDER BY 'whatever field' ASC
I can't seem to get it to accept a variable for the "actual" table name. I have no problems passing form variables for other areas of the select statement.
Thanks....
Try this:
SELECT *
FROM TableName
WHERE state = 'varState'
ORDER BY YourFieldNameHere ASC
request.form("state"
##Don't forget you also need an html form
##using the POST method with "state"
I need a repository or reference of ultradev code and libraries, all text based.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thank you for the reply .... but I am actually trying to pass a Variable for the "TableName" through the request.form("variable" from a Select list on the previous page.
So the select statement would be:
SELECT * FROM [variable picked up from request.form() to be the table name]
ORDER BY 'whatever field' ASC
I can't seem to get it to accept a variable for the "actual" table name. I have no problems passing form variables for other areas of the select statement.
Thanks....
Replied 07 May 2002 23:20:46
07 May 2002 23:20:46 josh padilla replied:
SELECT *
FROM varTableName
WHERE state = 'varTableName'
ORDER BY YourFieldNameHere ASC
varTableName comesfromform
request.form("state"
You might want to write out exactly what you're trying to push or pull from the table in a message.
FROM varTableName
WHERE state = 'varTableName'
ORDER BY YourFieldNameHere ASC
varTableName comesfromform
request.form("state"
You might want to write out exactly what you're trying to push or pull from the table in a message.