0

I want to assign a single backslash to a variable. I tried both single (\) slash and double (\\) slashes and checked. Can any one help me?

fdermishin
  • 3,519
  • 3
  • 24
  • 45
  • 1
    Aside from this being a duplicate, in future please show what you've tried as code rather than describing it, and tell us the results as well, compared with what you were expecting. – Jon Skeet Dec 17 '15 at 10:29
  • string sqlservername=textBox2.Text; string sqldatabasename=textBox2.Text; SqlConnection con = new SqlConnection("Data Source="+sqlservername+";Initial Catalog="+sqldatabasename+";Integrated Security=True"); When sqlservername =ADMIN\SQLEXPRESS,while running application the servername will change into ADMIN\\SQLEXPRESS which can be seen in debug mode – Srinath Kamath Dec 17 '15 at 11:01
  • So i thought that the server name can be made by adding two strings which can be seperated by a single back slash.thats why i asked ! – Srinath Kamath Dec 17 '15 at 11:09
  • All of this should be *edited into the question* rather than put as comments. But basically, the problem is that you're looking at the debugger representation of the string, which escapes backslashes. If you see `\\` in the debugger, there's only actually a single backslash in the string. Log it and you'll see that. – Jon Skeet Dec 17 '15 at 11:21

0 Answers0