Sunday, 15 August 2010

c# - Unrecognized escape character in asp.net -



c# - Unrecognized escape character in asp.net -

i have next piece of code in .cs file :

string connectionstring= "suman-pc\sqlexpress;initial catalog=northwind;integrated security=true";

it produce error unrecognized escape character "\" character.how solve this?

note:its in .cs file not in web.config

you didn't escapte backslashes. can done like

string connectionstring= @"suman-pc\sqlexpress;initial catalog=northwind;integrated security=true";

-> string prefixed @

or

string connectionstring= "suman-pc\\sqlexpress;initial catalog=northwind;integrated security=true";

-> prefix backslash one

c# asp.net database configurationmanager

No comments:

Post a Comment