简体   繁体   中英

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.

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(" ")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM