Mou
Mou

Reputation: 16292

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

Upvotes: 3

Views: 11125

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

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

Upvotes: 4

Related Questions