when ever I make connection it gives an error
Unrecognized escape sequence.
NEPOLEON\ADMN HERE ON THIS SLASH. NEPOLEON\ADMN IS MY SQL SERVER NAME.
SqlConnection con = new SqlConnection("Server=NEPOLEON\ADMN;Database=MASTER;Trusted_Connection=True");
Escape the \ character like :
SqlConnection con = new SqlConnection("Server=NEPOLEON\\ADMN;Database=MASTER;Trusted_Connection=True");
or
SqlConnection con = new SqlConnection(@"Server=NEPOLEON\ADMN;Database=MASTER;Trusted_Connection=True");
Try changing it to this:
SqlConnection con = new SqlConnection("Server=NEPOLEON\\ADMN;Database=MASTER;Trusted_Connection=True");
or this
SqlConnection con = new SqlConnection(@"Server=NEPOLEON\ADMN;Database=MASTER;Trusted_Connection=True");
In .NET you can escape special characters by either putting an @
in front of the string or using a special value to represent the character you want to escape. In this case you can use \\
to represent a \
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With