StrataFrame Forum

Backuping Up and Restoring SQL Server with SMO

http://forum.strataframe.net/Topic15065.aspx

By Trent L. Taylor - 3/20/2008

There have been some inquiries as to how to backup and restore SQL Server databases through an application in the field.  The best approach that we have learned for creating a reusable backup solution is to use SMO.  We have a service that runs within our medical application that automatically backs up the end-users database to a different file name each night...since they don't always do this themselves BigGrin

You can modify this logic to backup and restore individual file groups.  But this sample will at least get you started and shows how to backup and restore a single database using SMO.

Note: You may need to adjust the output folder path and the server settings in order to get this sample to work for you.