Hi Everyone,

I developed a page with FreeTextBox object
which allows update text using rich text format.

Now, If I type "TEST 123" and submit the data - works fine.
If I type "TEST 123' and submit the data - I recieve the following error:

Syntax error (missing operator) in query expression ''
"test 123' ' WHERE catid = 479'.

Also, If I copy\paste from Microsoft Word - I recieve similar errors..
The solution for that is to copy the text to notepad and then back to FreeTextBox editor.

I believe there is something to do with .Replace when post back but not sure what.

Can you please direct me?

Thanks!
YP

show me your code...wot u trying..?

Hi Everyone,

I developed a page with FreeTextBox object
which allows update text using rich text format.

Now, If I type "TEST 123" and submit the data - works fine.
If I type "TEST 123' and submit the data - I recieve the following error:

Syntax error (missing operator) in query expression ''
"test 123' ' WHERE catid = 479'.

Also, If I copy\paste from Microsoft Word - I recieve similar errors..
The solution for that is to copy the text to notepad and then back to FreeTextBox editor.

I believe there is something to do with .Replace when post back but not sure what.

Can you please direct me?

Thanks!
YP

you have to replace single quote with double quote because a varchar is enquoted in singe quote, if the query is encountered with single quote the DB will terminate the rest of the statement after single quote therefore you get an error message

Replace(TextBox1.Text, "'", """")

Mark as solved if it helps you!!!

"reach_yousuf" - You are a wizard!

I added

Replace("'", """")

to my code-behind and everything works smoothly, even if I copy\paste from Microsoft Word!!! Amazing.

Thank You so much!
YP