Showing posts with label store single quotes on database. Show all posts
Showing posts with label store single quotes on database. Show all posts

Friday, 13 January 2012

Store ‘(Single Quotes) containg string on database


If u want to store ‘(Single Quotes) on database, you should replace the Textbox value containing Single Quotes (‘) with double Single Quotes(‘’) just before saving Textbox value.
Just convert ‘ to ‘’

Ex: if Textbox named txtAddress contain value with Single Quotes(‘), then u should write below code.

txtAddress.Text = Replace(txtAddress.Text, "'", "''")

Note:- While retrieving data from Database, you did not need to convert ‘’ to ‘.
           You can assign converted Textbox value to itself, or any other string variable.