In past it has been a pain for developers to deploy a database driven application. You had to go through a list of SQL scripts to create tables and other database objects.
In ASP.Net 2.0, you can copy the .mdf file in \APP_DATA folder. Then XCOPY the entire application folder on the web server. Following one line of code in web.config will attach the database for you.
connectionString =" Data Source =.\SQLExpress;AttachDbFile=|DataDirectory|\ASPNETDB.MDF;Database =dbASPNETDB.MDF; User Instance=True; Trusted_Connection = Yes;"
The above connection string assumes you have an instance of SQL Server called SQLExpress running on you local machine. ASPNETDB.MDF is available in APP_DATA folder. ASPNET is trusted user.
In ASP.Net 2.0, you can copy the .mdf file in \APP_DATA folder. Then XCOPY the entire application folder on the web server. Following one line of code in web.config will attach the database for you.
connectionString =" Data Source =.\SQLExpress;AttachDbFile=|DataDirectory|\ASPNETDB.MDF;Database =dbASPNETDB.MDF; User Instance=True; Trusted_Connection = Yes;"
The above connection string assumes you have an instance of SQL Server called SQLExpress running on you local machine. ASPNETDB.MDF is available in APP_DATA folder. ASPNET is trusted user.
Comments