Im runing a script within an ASP page to update a row in a access database. I write the sql script to the screen, copy and paste it into Access and run it and it works perfectly. But generates an error in the ASP page.
The error is
Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
The code is as follows
SqlScript = "UPDATE Data SET "
SqlScript = SqlScript & "REFERENCE = '" & strREFERENCE & "', "
SqlScript = SqlScript & "NAME1 = '" & strNAME1 & "', "
SqlScript = SqlScript & "INT1ST = '" & strINT1ST & "', "
SqlScript = SqlScript & "NAME2 = '" & strNAME2 & "', "
SqlScript = SqlScript & "INT2ND = '" & strINT2ND & "', "
SqlScript = SqlScript & "ADDRESS1 = '" & strADDRESS1 & "', "
SqlScript = SqlScript & "ADDRESS2 = '" & strADDRESS2 & "', "
SqlScript = SqlScript & "ADDRESS3 = '" & strADDRESS3 & "', "
SqlScript = SqlScript & "ADDRESS4 = '" & strADDRESS4 & "', "
SqlScript = SqlScript & "POSTCODE = '" & strPOSTCODE & "', "
SqlScript = SqlScript & "UserID = '" & strUserID & "', "
SqlScript = SqlScript & "TYPEOFLOAN = '" & strTYPEOFLOAN & "', "
SqlScript = SqlScript & "LENDER = '" & strLENDER & "', "
SqlScript = SqlScript & "PURPRICE = '" & strPURPRICE & "', "
SqlScript = SqlScript & "LOAN = '" & strLOAN & "', "
SqlScript = SqlScript & "APP = '" & strAPP & "', "
SqlScript = SqlScript & "VALUATION = '" & strVALUATION & "', "
SqlScript = SqlScript & "VALUATIONMORE = '" & strVALUATIONMORE & "', "
SqlScript = SqlScript & "OFFER = '" & strOFFER & "', "
SqlScript = SqlScript & "OFFERMORE = '" & strOFFERMORE & "', "
SqlScript = SqlScript & "COMPLETION = '" & strCOMPLETION & "', "
SqlScript = SqlScript & "EXCHANGE = '" & strEXCHANGE & "', "
SqlScript = SqlScript & "STATUS = '" & strSTATUS & "', "
SqlScript = SqlScript & "SOLICITORS = '" & strSOLICITORS & "', "
SqlScript = SqlScript & "SOLICITORSMORE = '" & strSOLICITORSMORE & "', "
SqlScript = SqlScript & "COMMENTS = '" & strCOMMENTS & "', "
SqlScript = SqlScript & "AccLastUpdated = '" & strAccLastUpdated & "' "
SqlScript = SqlScript & " WHERE ID = " & strID
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open SqlScript, sConnString, , , adCmdText
The SQL statment produced is
UPDATE Users SET Password = 'example', Username = 'example', Company = 'Example UK', ContactFirst = 'Manchester', ContactLast = 'Office', Address1 = 'Example House', Address2 = 'Example Lane', Address3 = 'Example', PostCode = 'EX1 5PL', Phone = '01614554545', Fax = '01614554546', Email = 'mike@apseurope.com', Mobile = '' WHERE ID = 108
Matthew Wilde
matthew@ukwebsite.com