Link to home
Start Free TrialLog in
Avatar of wilko1000
wilko1000

asked on

C# escape characters

Hi

I have a test box that i want to display a SQL statment when a button is clicked. The SQL statement (that I want to appear in the text box has \\ characters and Quotations):

TextBox3.Text = "INSERT INTO Table VALUES (3497350,"AAA",3007260,"'\\LIVE\STORE\APPS\T1\\n02\Store\E_Input\Export\T90\'",52,24,72,"24-JAN-12 23.00.00.00000000",590,3495713,"Y","03 C T export v2","d53c0adc-7fe5-4c9a-b84a-5f9793145118","{0}_T9_{2}_{3}.csv";

How do i tell C# to ignore the \\ and Quotations?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Some extra info:
The @ symbol before any string literal (not just because it is SQL) instructs the compiler to ignore any escape sequences, just treat the string as it is.
Some extra info:
The @ symbol denotes a verbatim string literal in C#.
btw, I hope you don't use this to execute against a database.. Cause it is prone to SQL injection.