Use #PreserveSingleQuotes(form.textarea)# :�) Regards
Stephen Pope -----Original Message----- From: Ian Westbrook (FDM) [mailto:[EMAIL PROTECTED] Sent: 24 November 2003 12:55 To: CFUG List Subject: [ cf-dev ] dynamic SQL Hi I've written myself a page where I write some SQL into a textarea, then (try to) run that as a query (code at end of email) this is the query I'm putting into the textarea: UPDATE directory SET contactemail = 'not available' WHERE contactemail = '[EMAIL PROTECTED]' and this is the error: Error Diagnostic Information ODBC Error Code = 37000 (Syntax error or access violation) [Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression '''not available'''. SQL = "UPDATE directory SET contactemail = ''not available'' WHERE contactemail = ''[EMAIL PROTECTED]''" anyone any ideas? I see the double quotes - do I need to escape the single quotes in the query I write? TIA Ian W this is the code... <cfif IsDefined("form.sql")> <cfif form.query IS ''> <p>You have not specified a query to run!</p> <cfabort> <cfelse> <cfquery datasource="#dsn#"> #form.query# </cfquery> <p>That SQL query was executed.</p> </cfif> <cfelse> <br> <p class="redbold">DANGER! Do NOT, repeat <u>NOT</u> use this form unless you know what you are doing!!!!!</p> <p>Run an SQL operation on the database...</p> <cfoutput> <form action="#cgi.SCRIPT_NAME#" method="post"> <input type="hidden" name="CFID" value="#session.CFID#"> <input type="hidden" name="CFTOKEN" value="#session.CFTOKEN#"> <table width="600" border="0" cellspacing="0" cellpadding="5"> <tr> <td width="50" valign="top" align="right"><b>SQL</b></td> <td width="550"><textarea name="query" rows="15" cols="50"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="sql" value="Run query" onclick="this.value='Running...';"></td> </tr> </table> </form> </cfoutput> </cfif> -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
