Basically....
... I have a page which shows records from a database... in this case its records of electrical component parts. I also have a textbox called "txtquant" next to it in a form. When they click add next to the record it adds that record into another table in this case called "partlist".. that part is all working fine... but if the user types in 100 into the quantity textbox I want it to take the amount they typed in as a variable so I can put it into the "partlist" table.
My code is below... i tried "dim quantfrm" and then "quantfrm = CStr(Request.Querystring("txtquant"))" to in theory take what they typed into the box.. but the problem is in the SQL statement how do I call it? ive tried squarebrakcets around quantfrm as shown below. Any help gladly appreciated.
Dim RS
Dim RS_numRows
dim code
dim iaction
dim strsql
dim quantfrm
code= CStr(Request.QueryString("code"))
iaction= CStr(Request.QueryString("action"))
iupdate= CStr(Request.QueryString("iupdate"))
quantfrm = CStr(Request.Querystring("txtquant"))
'response.write form_string
'response.write form_field
private sub add()
if iupdate = "true" then
'response.write "update"
strsql = "INSERT INTO partlist ([comp_id],[pd_name],[cost], [quant]) SELECT instock.comp_id, instock.pd_name, instock.cost, [quantfrm] "
strsql = strsql & "FROM partlist RIGHT JOIN instock ON partlist.comp_id = instock.comp_id WHERE instock.comp_id='" & code & "'"
'response.write strsql
RS.ActiveConnection.Execute(strsql)
response.redirect("./project.asp")
... I have a page which shows records from a database... in this case its records of electrical component parts. I also have a textbox called "txtquant" next to it in a form. When they click add next to the record it adds that record into another table in this case called "partlist".. that part is all working fine... but if the user types in 100 into the quantity textbox I want it to take the amount they typed in as a variable so I can put it into the "partlist" table.
My code is below... i tried "dim quantfrm" and then "quantfrm = CStr(Request.Querystring("txtquant"))" to in theory take what they typed into the box.. but the problem is in the SQL statement how do I call it? ive tried squarebrakcets around quantfrm as shown below. Any help gladly appreciated.
Dim RS
Dim RS_numRows
dim code
dim iaction
dim strsql
dim quantfrm
code= CStr(Request.QueryString("code"))
iaction= CStr(Request.QueryString("action"))
iupdate= CStr(Request.QueryString("iupdate"))
quantfrm = CStr(Request.Querystring("txtquant"))
'response.write form_string
'response.write form_field
private sub add()
if iupdate = "true" then
'response.write "update"
strsql = "INSERT INTO partlist ([comp_id],[pd_name],[cost], [quant]) SELECT instock.comp_id, instock.pd_name, instock.cost, [quantfrm] "
strsql = strsql & "FROM partlist RIGHT JOIN instock ON partlist.comp_id = instock.comp_id WHERE instock.comp_id='" & code & "'"
'response.write strsql
RS.ActiveConnection.Execute(strsql)
response.redirect("./project.asp")