Query which has a single quote runs fine when the exact query is written inside the cfquery tag.<br>
But when the query is built dynamically with a single quote , that is outside the cfquery tag and later on used inside the cfquery tag replaces the single quote with two single quotes.<br>
like<br>
<cfset queryString = "select * from emp where empname='#Jone#'"><br>
<cfquery name="checkquery" datasource="checksource" dbtype="ODBC"> <br>
#queryString#<br>
</cfquery><br>
<cfoutput>#checkquery.group_id#</cfoutput><br>
<br>
if this basic query is run it replaces the query string with two single quotes<br>
<br>
select * from emp where empname=''Jone'' {it has two single quotes}<br>
the error is<br>
<br>
ODBC Error Code = 37000 (Syntax error or access violation)<br>
<br>
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00933: SQL command not properly ended<br>
<br>
Data Source = "checksource"<br>
<br>
please send you comments to <A HREF="mailto:kuvind@pnewpda0.tpc.natp.gmeds.com">kuvind@pnewpda0.tpc.natp.gmeds.com</A>
But when the query is built dynamically with a single quote , that is outside the cfquery tag and later on used inside the cfquery tag replaces the single quote with two single quotes.<br>
like<br>
<cfset queryString = "select * from emp where empname='#Jone#'"><br>
<cfquery name="checkquery" datasource="checksource" dbtype="ODBC"> <br>
#queryString#<br>
</cfquery><br>
<cfoutput>#checkquery.group_id#</cfoutput><br>
<br>
if this basic query is run it replaces the query string with two single quotes<br>
<br>
select * from emp where empname=''Jone'' {it has two single quotes}<br>
the error is<br>
<br>
ODBC Error Code = 37000 (Syntax error or access violation)<br>
<br>
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00933: SQL command not properly ended<br>
<br>
Data Source = "checksource"<br>
<br>
please send you comments to <A HREF="mailto:kuvind@pnewpda0.tpc.natp.gmeds.com">kuvind@pnewpda0.tpc.natp.gmeds.com</A>