Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql server express and connection string in web.config

i have connection string stored in web.config file but it is giving me the error.

<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbProduct.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

where is the bug in the connection string. i have stored my db DbProduct.mdf in app_data folder. i have never use SQLEXPRESS. so i need guide line. thanks

like image 682
Mou Avatar asked Apr 17 '26 09:04

Mou


1 Answers

this AttachDbFilename=|DataDirectory|\DbProduct.mdf

should be AttachDbFilename=|DataDirectory|DbProduct.mdf

You don't need to add \

Have a look at this Using connection strings from web.config in ASP.NET v2.0

like image 68
Muhammad Akhtar Avatar answered Apr 18 '26 23:04

Muhammad Akhtar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!