C# escape characters


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",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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try this..

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',590
,3495713,'Y','03 C T export v2','d53c0adc-7fe5-4c9a-b84a-5f9793145118','{0}_T9_{2}_{3}.csv');";

Open in new window

for SQL values, we use single quotes to represent char values

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
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.
ste5anSenior DeveloperCommented:
Some extra info:
The @ symbol denotes a verbatim string literal in C#.
ste5anSenior DeveloperCommented:
btw, I hope you don't use this to execute against a database.. Cause it is prone to SQL injection.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.