none
how to make a database backup from localdb using c#.net RRS feed

  • Question

  • How can i make a dababase backup of localdb without using Sql server,Just Using visual studio local db .

    Can I do that. If so than please give some useful help .

    Thank.

    Monday, March 3, 2014 1:17 PM

Answers

  • You can use the Microsoft.SqlServer.Management.Smo dll.

    It's straight forward:

     string serverName = "localhost";
                string dbName = "myDB";
                Server server = new Server(serverName);
                Database db = server.Databases[dbName];
                Backup backup = new Backup();
               /*Add settings to backup, similar to what you would use in Sql Management Studio*/
                backup.SqlBackup(server);

    Monday, March 3, 2014 2:20 PM