Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <5066304.ojPbGhBDv6@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Wed, 13 Nov 2013 02:45:27 +0100 User-Agent: KNode/4.10.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. MIME-Version: 1.0 Lines: 48 NNTP-Posting-Date: 13 Nov 2013 02:45:29 CET NNTP-Posting-Host: ff74c4ba.newsspool1.arcor-online.net X-Trace: DXC=CL7D8]UHJ:G[6=1B@oB@@@ic==]BZ:afN4Fo<]lROoRAnkgeX?EC@@@g^WmZX^PGjCDZm8W4\YJNLYUVHKH;GI^G9K67=SAS@HJD^G`JOjScjA X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:21992 Andrew Poulos wrote: > I'm trying to update an MS Access db using ASP and JScript with this > SQL. The value for "notes" is a JSON string posted via AJAX. > > UPDATE tbl_Responses > SET notes= > '{ > "loc": "", > "suspend_data": "{'assess':{},'limit':1,'loc':'','progress':'1'}", > "comments": "", > "completion": "completed", > "scoEntry": "resume", > "userID": 11, > "lessonID": 2 > }' > WHERE ResponseID=67; You should not store JSON in the database. You should store the JSON data in properties of your model object which then generates the database query (by use of a database adapter so that you only have to change the adapter when you change the database [which is going to happen with an Access database sooner or later]). > Running it gives the error > Syntax error (missing operator) in query expression "{... > > If I test the JSON in a JSON validator it checks out as valid. > > If I delete the "suspend_data" line the SQL runs as expected. > > Why is the "suspend_data" line causing the error? It contains a “'” which is the SQL string delimiter here. As you have been told before, you need to sanitize your input. See also: -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.