2

Basically problem starts from my c# code. it is showing error in my connection string. In connection i mentioned server name like, Chaitanya\SQLEXPRESS and at compile time it shows the error at " \ ".

My Connection string

 SqlConnection con = new SqlConnection("Server=Chaitanya\SQLEXPRESS;user Id=sa;password=sa@12;Database=err");

Now i am trying to change my sql server name and for this i created one server name. First i used this command sp_dropserver and then sp_addserver finally restart. The Server name is created successfully. but unable to login. So i create a new login ,and it is created , but for current logged in server only. Now how can i do...?? how to login using newly created login..?? or how to change the server name of created login account..?? sorry for if any mistakes in question...

1 Answers1

1

\ stands for escape character and is a reserved keyword.so in your case ,you need to add \\ .More info here

Chaitanya\\SQLEXPRESS

or
@symbol before connection string..

(@"Server=Chaitanya\SQLEXPRESS;user 
Community
  • 1
  • 1
TheGameiswar
  • 27,855
  • 8
  • 56
  • 94