小新二三事 二三事 電視精/戲院 ASP .NET 新手工作日誌

2009年7月11日星期六

ASP.NET Step: Move / Export Database from Microsoft SQL Server 2008 to mdf File

ASP.NET Step: Move / Export Database from Microsoft SQL Server 2008 to mdf File

1. Download SQL Server Management Studio
from VWD website

2. Read the followings doc
http://www.windows-tech.info/15/206f0457374acafb.php

3. Follow Steps in
How to: Detach a Database (SQL Server Management Studio)
http://msdn.microsoft.com/en-us/library/ms191491.aspx

4. Copy the mdf to VWD website's App_Data Folder
from
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA

5. Open Web.config
Replace the connection String as we detached the database from server
and run it as standalone file

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

沒有留言: