Click here to Skip to main content
16,011,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I have small doubt. When user enters the ' (single quotes) in the text field.
While inserting in Table, it give us the error.
But I have seen in few sites eg- Facebook, CodeProject where they allow ' (single quotes) and display the same.
Can anyone guide me on this.
Posted
Updated 26-Nov-13 18:47pm
v2

On the submit, use a bit of code that is like this:

VB
replace(TEXTBOXNAME, "'", "''")


Of course, a better option would be to use a stored procedure and parameter, thus not needing to worry about it!!
 
Share this answer
 
Hi,

If you want to add '(apostrophe) in sql server, then it should be like this

INSERT INTO exampleTbl VALUES('Hope this works for you - R''K');

Output will be
Hope this works for you - R'K

Add two apostrophe(') if you want to add one.

Hope this helps you a bit.

Regards,
RK
 
Share this answer
 
v2
Comments
Member 10318207 27-Nov-13 1:16am    
I know that, But think, if the user submitting a data of 5 to 10 pages. Then how to do it, do i need to write replace query for all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900