Re: Informix single quote Unterminated string constant error
Posted in 2004
nate wrote: > I am running Informix 7.31, CSDK 2.81.TC3, (IIS 5.0, IE6) and I am > trying to assign the value of a Recordset field to an array element > with this code... > > aRs_PSPA[cnt][3] = oRs2.Fields("spa_desc").Value; > > ...but I get an "Unterminated string constant" error? The error only > occurs when there is a single quote (') in the Recordset value: eg. > when spa_desc = "NATE'S EPB 1", I get the error, but when spa_desc = > "NATES EPB 1", I do NOT get the error. I only get the error when I > assign the Recordset value to an array variable, so this code works > correctly... > > var test = oRs2.Fields("spa_desc"); > > Is there a bug in the Informix OLE DB SDK? Do I need to use a > JavaScript function to double-up on single quotes (as I do in INSERT > statements)? I'd hazard a guess that there's a bug somewhere in the software stack, but whether it is in Informix OLEDB or something else depends on what happens if you use a different database server. If you get the same error against a different DBMS, the problem is presumably in the calling code and yes, you do need to double up on single quotes. If other OLEDB drivers support the notation without problem, then you have a bug that should be reported to IBM Tech Support. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/