title: Export a SQL Server database from C# and re-import
body: <p>I'm looking for a way to create a backup of a SQL Server 2008 database in C# code. I then wish to re-import this database to a local database server, again using C# code. </p>
  
  <p>I know this can be done via the SQL Server Management Studio very easily, but need an automated way to achieve this. </p>