Reputation: 5
I am using connection string like this:
SqlConnection con = new SqlConnection("Data Source=DESKTOP-8L8G5P8\SQLEXPRESS;Initial Catalog=sai;User ID=sa);
But it raises the error at the server name.
Upvotes: 0
Views: 65
Reputation: 847
I think you have messed up somethings .Try this.It may work
SqlConnection con = new SqlConnection("Data Source=DESKTOP-8L8G5P8\\SQLEXPRESS;Initial Catalog=sai;User ID=sa;");
you have messed double slash(\\) and double quote(" ")
Upvotes: 1