Page Source View:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Database.aspx.cs" Inherits="Database" %>
Code View:-
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
public partial class Database : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
File.Copy("D:/Demo3tyre/App_Data/shiba.mdf", "E:/Backup/db/shiba.mdf");
File.Copy("D:/Demo3tyre/App_Data/shiba_log.ldf", "E:/Backup/db/shiba_log.ldf");
Response.Write("");
}
catch (Exception)
{
throw;
}
}
}
By click on that button You can store our database in a specific folder which is provided by you.
Before that go to server explorer or your management studio and right click on database i,e. shiba(which is my database name) and click on Detach.
No comments:
Post a Comment