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\STOR E\APPS\T1\ \n02\Store \E_Input\E xport\T90\ '",52,24,7 2,"24-JAN- 12 23.00.00.00000000",590,349 5713,"Y"," 03 C T export v2","d53c0adc-7fe5-4c9a-b8 4a-5f97931 45118","{0 }_T9_{2}_{ 3}.csv";
How do i tell C# to ignore the \\ and Quotations?
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,"'\
How do i tell C# to ignore the \\ and Quotations?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Some extra info:
The @ symbol denotes a verbatim string literal in C#.
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.
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.