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

send parameter data to the database

Status
Not open for further replies.

Mary10k

IS-IT--Management
Nov 8, 2001
103
US
hello,
I have form A which users click on a hyperlink and the hyperlink values is displayed on form B. Users input text on from B and that is input into the datbase. I am having trouble inserting the passed parameter from form A into the database.

Here is the code I am using:
frmName = Request.Form("Name")
sqlStatement = "INSERT INTO Meta_Data (Name) VALUES ('"&<%=Name%&>"') "

Any suggestions and can this be done?
Thanks,
 
you don't need to use the [blue]<%= %>[/blue] brackets if you are already inside an asp code block:

Code:
<%
frmName = Request.Form("Name")
sqlStatement = "INSERT INTO Meta_Data (Name) VALUES ('" & [blue]frmName[/blue] & "') "
%>

Earnie Eng
 
This is what I tried originally and it is inserting a blank value in the Name field. The value isn't being passed for some reason.
 
in your code above... you are assinging a value to the variable "frmName", but you try to inser the variable "name"

Here is the code I am using:
[red]frmName[/red] = Request.Form("Name")
sqlStatement = "INSERT INTO Meta_Data (Name) VALUES ('"&<%=[red]Name[/red]%&>"') "

be careful that you are inserting the correct value into your query string.

also... it doesn't hurt to put a response.write/end after the assignment of the sql statement to make sure that it is getting proper values:
Code:
<%
frmName = Request.Form("Name")
sqlStatement = "INSERT INTO Meta_Data (Name) VALUES ('" & frmName & "') "
[red]response.Write(sqlStatement)
response.End()[/red]
%>

this will print the sql statement to the browser and stop all processing thereafter, so you can see what the result is for troubleshooting/debugging

Earnie Eng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top