krish sin

krish sin

  • NA
  • 17
  • 1.3k

how to restore backup data using asp.net

Jan 5 2017 6:33 AM
protected void Button2_Click(object sender, EventArgs e)
{
try
{
con.ConnectionString = ("Data Source=SYSTEM-6-PC;Initial Catalog=Master;Integrated Security=True");
con.Open();
string test = "D:\\backupdb\\05012017_130700.Bak";
sqlcmd = new SqlCommand("Restore database EmpolyeeTable from disk='D:\\backupdb\\05012017_130700.Bak'", con);
sqlcmd.ExecuteNonQuery();
Response.Write("restore database successfully");
}
catch (Exception ex)
{
Response.Write("Error During backup database!");
}
}

Answers (4)