backup .bak file to remote hosting (ipage server )

Last Reply 19 hours ago By rani

Posted 10 days ago

hi all

i want some edting to save .bak file on remot server (i will purchase hosting  on ipage server )


this is my code that save .bak file on local HD



 // read connectionstring from config file
        var connectionString = ConfigurationManager.ConnectionStrings["myconstr"].ConnectionString;

        // read backup folder from config file ("C:/temp/")
        var backupFolder = ConfigurationManager.AppSettings["BackupFolder"];

        var sqlConStrBuilder = new SqlConnectionStringBuilder(connectionString);

        // set backupfilename (you will get something like: "C:/temp/MyDatabase-2013-12-07.bak")
        var backupFileName = String.Format("{0}{1}-{2}.bak",
            backupFolder, sqlConStrBuilder.InitialCatalog,
            DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss"));

        using (var connection = new SqlConnection(sqlConStrBuilder.ConnectionString))
            var query = String.Format("BACKUP DATABASE {0} TO DISK='{1}'",
                sqlConStrBuilder.InitialCatalog, backupFileName);

            using (var command = new SqlCommand(query, connection))
                Response.Write("successfully  Backup DB");



You are viewing reply posted by: dharmendr 5 days ago.
I agree, here is the link: