I am preparing the text of a stored procedure using StringBuilder but
bumps into \r\n issues...
I use some syntax like
MyStringBuilder.Append("Something very clever here");
MyStringBuilder.Append("\r\nGO");
If I then write MyStringBuilder.ToString() into a file, it's perfect as
I have in my file
Something very clever here
GO
Great!
However, if I try to send the content of MyStringBuilder.ToString()
directly to the database engine (SQL Server), it does not work because
the "\r" and "\n" are not interpreted as Carriage Return Line Feed but
merely as "\" followed by "r" or "n"...
Another symptom of the same problem seems to be that if I run this in a
VB.Net debug window
?String.Format("*{0}*", chr(13))
I get
"*
*"
but I don't manage to do it in C#
?String.Format("*{0}*", (char)13)
gives
"*\r*"
Can somebody explain this to me, please?