I get the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
I've checked the names allocated to the table and field names against an SQL reserved word list and they do not appear on there. I've also tried renaming the table and all its fields and made changes in the code respectively but I'm still getting the same error. Anybody have any ideas? Code below, thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% 'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateQuestion 'Holds the recordset for the record to be updated
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection"
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ksp.mdb"
Dim iCount
iCount=Request.Form("Count"
Dim strSQL 'Holds the SQL query to query the database
'need to get each value from previous page
Dim strOptionID, strQuestion, strOption, strResponse, strMark, strTick
'loop through each form element
Dim iLoop
For iLoop=0 to iCount
strOptionID=Request.Form(iLoop & ".optionid"
strQuestion=Request.Form(iLoop & ".questionid"
strOption=Request.Form(iLoop & ".optiontext"
strResponse=Request.Form(iLoop & ".reply"
strMark=Request.Form(iLoop & ".mark"
strTick=Request.Form(iLoop & ".tick"
strSQL="UPDATE QuestionOptions SET [QuestionID] =" & strQuestion &" , [OptionText] ='" & strOption &"', [Reply] ='" & strResponse &"', [Mark]=" & strMark &" , [Tick] = "& strTick &" WHERE [OptionID] = " & strOptionID &""
adoCon.Execute strSQL
Next
'Reset server objects
adoCon.Close
Set adoCon = Nothing
'Return to the update select page in case another record needs ammending
Response.Redirect "optionupdate.asp"
%>
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
I've checked the names allocated to the table and field names against an SQL reserved word list and they do not appear on there. I've also tried renaming the table and all its fields and made changes in the code respectively but I'm still getting the same error. Anybody have any ideas? Code below, thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% 'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateQuestion 'Holds the recordset for the record to be updated
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection"
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ksp.mdb"
Dim iCount
iCount=Request.Form("Count"
Dim strSQL 'Holds the SQL query to query the database
'need to get each value from previous page
Dim strOptionID, strQuestion, strOption, strResponse, strMark, strTick
'loop through each form element
Dim iLoop
For iLoop=0 to iCount
strOptionID=Request.Form(iLoop & ".optionid"
strQuestion=Request.Form(iLoop & ".questionid"
strOption=Request.Form(iLoop & ".optiontext"
strResponse=Request.Form(iLoop & ".reply"
strMark=Request.Form(iLoop & ".mark"
strTick=Request.Form(iLoop & ".tick"
strSQL="UPDATE QuestionOptions SET [QuestionID] =" & strQuestion &" , [OptionText] ='" & strOption &"', [Reply] ='" & strResponse &"', [Mark]=" & strMark &" , [Tick] = "& strTick &" WHERE [OptionID] = " & strOptionID &""
adoCon.Execute strSQL
Next
'Reset server objects
adoCon.Close
Set adoCon = Nothing
'Return to the update select page in case another record needs ammending
Response.Redirect "optionupdate.asp"
%>