日期:2014-05-18 浏览次数:22014 次
protected void Button1_Click(object sender, EventArgs e) { SQLDMO.Backup oBackup = new SQLDMO.BackupClass(); SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass(); try { oSQLServer.LoginSecure = false; oSQLServer.Connect("localhost", "sa", "daili"); oBackup.Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database; oBackup.Database = "electricity"; oBackup.Files = @Server.MapPath("/images/"); oBackup.BackupSetName = "electricity"; oBackup.BackupSetDescription = DateTime.Now.ToString(); oBackup.Initialize = true; oBackup.SQLBackup(oSQLServer); } catch (Exception ex) { throw ex; } finally { oSQLServer.DisConnect(); } }