Introduction
I see several posts on a lot of sites with people trying to create string
s with embedded double quotes. This can be easily achieved with string builder in .NET.
Using the Code
The trick is to use a StringBuilder
to and wrap the double quote within two single quotes.
The example below builds a string
fragment for building a SQL for Oracle with uses double quotes to surround field names (TSQL uses []
).
StringBuilder sb = new StringBuilder();
var col = "Name Col";
sb.Append('"' + col + '"');
sb.Append(" = @NAME ");
History