Home > DeveloperSection > Forums > Data Backup
Amresh Kushwaha

Total Post:38

Posted on    May-12-2011 9:30 PM

 MSSQL Server MSSQL Server 

 4 Reply(s)
 1351  View(s)
Rate this:
How to take backup of sel server 2005

Uttam Misra

Total Post:124

Posted on    May-13-2011 12:07 AM

In Management Studio select database >> right click on selected database >> tasks >> back up

Amresh Kushwaha

Total Post:38

Posted on    May-13-2011 7:53 AM

I want to command

Awadhendra Tiwari

Total Post:126

Posted on    May-13-2011 8:04 AM

Write down following code snippet in c# to take backup. One thing remeber that creadential should be changed..

using System;
using System.Data;
using System.Collections;

using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;

class Program
static void Main(string[] args)
BackupDeviceItem bdi =
new BackupDeviceItem("AdventureWorks.bak", DeviceType.File);

Backup bu = new Backup( );
bu.Database = "AdventureWorks";
bu.Initialize = true;

// add percent complete and complete event handlers
bu.PercentComplete +=
new PercentCompleteEventHandler(Backup_PercentComplete);
bu.Complete +=new ServerMessageEventHandler(Backup_Complete);

Server server = new Server("localhost");

Console.WriteLine(Environment.NewLine + "Press any key to continue.");
Console.ReadKey( );

protected static void Backup_PercentComplete(
object sender, PercentCompleteEventArgs e)
Console.WriteLine(e.Percent + "% processed.");

protected static void Backup_Complete(object sender, ServerMessageEventArgs e)
Console.WriteLine(Environment.NewLine + e.ToString( ));

Amresh Kushwaha

Total Post:38

Posted on    May-14-2011 5:40 AM

Don't want to miss updates? Please click the below button!

Follow MindStick