1) first of all i have to deattach database from sql server
a) open sql server
b) connect your server
c) open node of database and right click on your database and choose task menu and then choose deattach then database will deattached
2) In second step in visual studio 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 it will be in In my case ( C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\accountdb.mdf) and now this database will add in app_data folder
3) Now change your connection string in config file
Collapse | Copy Code
<connectionstrings>
<add connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Accountdb.mdf;Integrated Security=True;User Instance=True " name="ConnectionASPX" providername="System.Data.SqlClient" />
</connectionstrings>
//here |DataDirectory| is path of app_data folder and accountdb is the name of database name can be anything of connectionstring.
Thank You if this solution helps you so please vote for me