0

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

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ypdev
0

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!!!

Edited by reach_yousuf: n/a

0

"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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.