The message
Represents text as a series of Unicode characters
is not a mistake, is the description of string
.
The code actually has an error which is to use the \
as literal, this character needs to be escaped.
There are two options for this:
Use \
to escape that character only.
Ex.: "Teste\\Teste
" amounts to Teste\Teste
.
new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;OutrosParametros");
Use @
at the beginning of string
. This will cause the text to be represented that way. In other words, the string
turned into a string literal (or Verbatim string).
Ex.: @"Teste\nTeste"
amounts to Teste\nTeste
.
new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB;OutrosParametros");