Skip to main content
edited tags
Link
Jeromy French
  • 12.1k
  • 19
  • 79
  • 136
Capitalized ColdFusion and "I".
Source Link
Shawn Holmes
  • 3.7k
  • 25
  • 26

Coldfusion ColdFusion adding extra quotes when constructing database queries in strings

I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with <cfquery blah > #query# </cfquery>

Somehow though, when iI construct my queries with sql = "SELECT * FROM a WHERE b='#c#'" and pass it in, coldfusionColdFusion has replaced the single quotes with 2 single quotes. so it becomes WHERE b=''c'' in the final query.

I have tried creating the strings a lot of different ways, but iI cannot get it to leave just one quote. even Even doing a string replace has no effect.

Any idea why this is happening? It is ruining my hopes of living in cfscript for the duration of this project

Coldfusion adding extra quotes when constructing database queries in strings

I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with <cfquery blah > #query# </cfquery>

Somehow though, when i construct my queries with sql = "SELECT * FROM a WHERE b='#c#'" and pass it in, coldfusion has replaced the single quotes with 2 single quotes. so it becomes WHERE b=''c'' in the final query.

I have tried creating the strings a lot of different ways, but i cannot get it to leave just one quote. even doing a string replace has no effect.

Any idea why this is happening? It is ruining my hopes of living in cfscript for the duration of this project

ColdFusion adding extra quotes when constructing database queries in strings

I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with <cfquery blah > #query# </cfquery>

Somehow though, when I construct my queries with sql = "SELECT * FROM a WHERE b='#c#'" and pass it in, ColdFusion has replaced the single quotes with 2 single quotes. so it becomes WHERE b=''c'' in the final query.

I have tried creating the strings a lot of different ways, but I cannot get it to leave just one quote. Even doing a string replace has no effect.

Any idea why this is happening? It is ruining my hopes of living in cfscript for the duration of this project

Source Link
Alex
Alex

Coldfusion adding extra quotes when constructing database queries in strings

I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with <cfquery blah > #query# </cfquery>

Somehow though, when i construct my queries with sql = "SELECT * FROM a WHERE b='#c#'" and pass it in, coldfusion has replaced the single quotes with 2 single quotes. so it becomes WHERE b=''c'' in the final query.

I have tried creating the strings a lot of different ways, but i cannot get it to leave just one quote. even doing a string replace has no effect.

Any idea why this is happening? It is ruining my hopes of living in cfscript for the duration of this project