sai
sai

Reputation: 5

Connection string in asp.net

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

Answers (1)

Diwas Poudel
Diwas Poudel

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

Related Questions