# Problem with Escape characters

**URL:** <https://forum.kirupa.com/t/problem-with-escape-characters/314641>\
**Category:** Uncategorized\
**Created:** [October 5, 2010, 9:02am UTC](https://forum.kirupa.com/t/problem-with-escape-characters/314641 "2010-10-05T09:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoeson](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@shoeson](https://forum.kirupa.com/u/shoeson)\
**Post date:** [October 5, 2010, 9:02am UTC](https://forum.kirupa.com/t/problem-with-escape-characters/314641/1 "2010-10-05T09:02:39Z")

</div>

hi  
i am using MS Access as my database in c#.

to insert a row in a table i write queries like:

string.Format(“INSERT INTO TABLE VALUES( ‘{0}’, ‘{1}’)”, value1, value2);

suppose value1 = apple which is obtained from a textbox.

while executing the query it works well.

but if the content of the text box is **appl’e** then there occurs an error because of the **’** character.

also if i use “{0}” instead of ‘{0}’ and if the content of text box is app"le then again a syntax error occurs while executing the SQL query.

how can i escape those characters so that they get inserted into the database.
