Step 1:
Detach Database from SQL Server.
i) Open Sql Server
ii) Login to Server
iii) Select the DB that you going to attach to application, and right click for the option to detach the DB.
Step 2:
Right click on app_data folder and click on add existing item and then select database which you want to add in app_data folder,DB will exist in C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\...
Step 3:
Alter the your connection string as below:
<connectionstrings>
<add connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DBName.mdf;Integrated Security=True;User Instance=True " name="ConnectionName" providername="System.Data.SqlClient" />
</connectionstrings>
Detach Database from SQL Server.
i) Open Sql Server
ii) Login to Server
iii) Select the DB that you going to attach to application, and right click for the option to detach the DB.
Step 2:
Right click on app_data folder and click on add existing item and then select database which you want to add in app_data folder,DB will exist in C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\...
Step 3:
Alter the your connection string as below:
<connectionstrings>
<add connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DBName.mdf;Integrated Security=True;User Instance=True " name="ConnectionName" providername="System.Data.SqlClient" />
</connectionstrings>
Comments
Post a Comment