Question

Possible Duplicate:
Backup SQL Server via C#

I have a Windows Forms project which is storing some values in SQL Server 2008 R2, I have many tables in there which deals with my application.

I would like to take a database backup so that if the user is to loose the operating system and reinstall, they can restore the database using the backup (.BAK file).

I would like to know how I can take a backup from SQL Server 2008 R2 with C#, and if it's compulsory to install SQL Server in the client computer whilst taking the backup.

Also, how can I restore it? Any examples may help.

Was it helpful?

Solution

You'll need to install the client tools.

What you'll need is SMO (Sql Server Management Objects)

This provides an api to perform certain Sql Server tasks including backups

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top