View previous topic :: View next topic |
Author |
Message |
davemcdougall
Joined: 17 Jun 2005 Posts: 2
|
Posted: Mon Jun 20, 2005 8:30 pm Post subject: Passing a variable into an SQL |
|
|
Hello,
I am trying to make a variable appear in an SQl but am not sure how. Here is the sample code...
if Request("regtrans") = "" then
regtrans_update = "null"
else
regtrans_update = Request("regtrans")
end if
if Request("warranty") = "" then
warranty_update = "null"
else
warranty_update = Request("warranty")
end if
sqlsave = "INSERT INTO fib_treat (fib_treat_warr_id,fib_treat_regtrans,fib_treat_su rname,fib_treat_date_treat,fib_treat_kit,fib_treat _del_cust) VALUES ('" &Request("warranty_update") &"','" &Request("regtrans_update") &"','" &escapesql(Request("surname")) &"','" &Request("date_treated") &"','" &Request("kit") &"','" &Request("del_date") &"')"
objConn.Execute sqlsave
All the fields are coming from a form which has been submitted. I I do Response.Write Ion the variables...
Response.Write regtrans_update
Response.Write warranty_update
It show's the correct responses as per the if statements above. I just don't know how to get the variable into the SQL?
Any idea's?
Dave |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Tue Jun 28, 2005 8:05 am Post subject: |
|
|
Instead of Request("regtrans_update") and Request("warranty_update") use directly regtrans_update and warranty_update:
sqlsave = "INSERT INTO fib_treat (fib_treat_warr_id,fib_treat_regtrans,fib_treat_su rname,fib_treat_date_treat,fib_treat_kit,fib_treat _del_cust) VALUES ('" & warranty_update &"','" & regtrans_update &"','" &escapesql(Request("surname")) &"','" &Request("date_treated") &"','" &Request("kit") &"','" &Request("del_date") &"')" _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|