The simplest way is to use the T-SQL commands
BACKUP[
^] and
RESTORE[
^] which you would issue through an
SqlCommand-object with
ExecuteNonQuery() like any other non-query-statement (e.g. INSERT or CREATE TABLE).
For example, the most basic backup-command would look similar to this:
BACKUP DATABASE myDatabaseName TO DISK = 'C:\somewhere\myDatabaseName.bak';
Additionally to the MSDN-Docs linked above:
Some examples for backup-commands:
http://www.mssqltips.com/sqlservertutorial/20/sql-server-backup-database-command/[
^]
How to create a backup- or restore-command via SQL-Server Management Studio (which you could then copy into your application):
http://www.sqlteam.com/article/backup-and-restore-in-sql-server-full-backups[
^]