简体   繁体   中英

Error 40 - Could not a open connection to sql server

In my windows application there is an error. Please can anyone tell me what is my mistake in connection string for local database? This is my code:

<add name="ACT_WIN.Properties.Settings.Database1ConnectionString"
    connectionString="Data Source=(LocalDB)\v11.0;
    AttachDbFilename=|DataDirectory|\Database1.mdf;
    Integrated Security=True"
    providerName="System.Data.SqlClient" />

And this is my error:

错误信息

I think your Wrong is in app.config -> ConnectionString -> Data Source =. or someting else,without set other Properties try this in ConnectionString ...

Data Source=(localdb)\v11.0;AttachDbFilename=|DataDirectory|\DB.mdf;integrated security=true;database=DB" providerName="System.Data.SQLExpress"

Good Luck

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