I am trying to update fields in a SQL Table which already has all the States and some data in it. I keep getting an error of "Incorrect Syntax near ','. What am I missing or not doing right to return my values to a "Read Only" page here?
The form data from the previous page is:
<form name = 'updatedata' action = 'update.asp' method = 'post'>
And the code for update.asp is as follows:
The form data from the previous page is:
<form name = 'updatedata' action = 'update.asp' method = 'post'>
And the code for update.asp is as follows:
Code:
Dim numGuar, numPool, numTrans, strState
numGuar = Request.Form("Guar")
numPool = Request.Form("Pool")
numTrans= Request.Form("Trans")
strState = Request.Form("State")
If Request.Form("sent") <> "" then
Dim strSQL
strSQL = "UPDATE Table SET"
strSQL = strSQL & " Guar = " & numGuar & ","
strSQL = strSQL & " Pool = " & numPool & ","
strSQL = strSQL & " Trans = " & numTrans
strSQL = strSQL & " WHERE State = '" & strState & "';"
set cxn=server.CreateObject("ADODB.Connection")
cxn.Open strConn, UserID, PWD 'defined in cxn.asp
set rst=server.CreateObject("ADODB.Recordset")
cxn.Execute strSQL
Response.Redirect ("readonly.asp")
rst.Close
set rst = nothing
cxn.Close
set cxn = Nothing
End if