Sql server express and connection string in web.config

10,770

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

Share:
10,770
Mou
Author by

Mou

my friends are id http://stackoverflow.com/users/508127/thomas http://stackoverflow.com/users/6188148/monojit-sarkar

Updated on June 05, 2022

Comments

  • Mou
    Mou almost 2 years

    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