Friday, February 10, 2012

Unrecognized escape sequence in C# SQL

I 've faced an problem in SQL server database connectivity from C# its all because my server name consist of  "\" ,C# read \ as n escape sequence to resolve this problem  use "@" symbol before the connectivity statement.

("Server=DIVI-PC\SQLEXPRESS;database=project")

Here is the problem there is "\" after the DIVI-PC C# reads its as an escape sequence so it is not possible to connect with sql  to Solve this problem add "@"

(@"Server=DIVI-PC\SQLEXPRESS;database=project")

Now it 'll work .

NOTE : Don't forget to add username and passwords

Suggestions are always welcome !!

No comments:

Post a Comment