Question
Wacko MSSQL Error
I am having problems inserting to a mssql database with
single quotes around my data, does anyone know a way around this?
The inserts work fine with out the single quotes. I am trying to
wrap the form input to have the correct syntax that mssql requires,
for instance:
<CFSET Head = ", ' ">
<CFSET Foot = "''">
<CFIF form.Project_Num neq "">
<CFSET Project_Num = Head&form.Project_Num&Foot>
<CFSET Project_NumCol = ", Project_Num">
<CFELSE>
<CFSET Project_Num = "">
<CFSET Project_NumCol = "">
</CFIF>
I am trying to make the code omit columns that dont have data entered, but the wrapping seems to not be working. Every time it tries to execute it errors to: Incorrect syntax near '2'.
<CFSET Head = ", ' ">
<CFSET Foot = "''">
<CFIF form.Project_Num neq "">
<CFSET Project_Num = Head&form.Project_Num&Foot>
<CFSET Project_NumCol = ", Project_Num">
<CFELSE>
<CFSET Project_Num = "">
<CFSET Project_NumCol = "">
</CFIF>
I am trying to make the code omit columns that dont have data entered, but the wrapping seems to not be working. Every time it tries to execute it errors to: Incorrect syntax near '2'.