日期:2014-05-18 浏览次数:20466 次
protected void bfbtn_Click(object sender, ImageClickEventArgs e) { SQLDMO.Backup oBackup = new SQLDMO.BackupClass(); SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass(); try { string filename = DateTime.Now.ToString() + ".bak"; oSQLServer.LoginSecure = false; oSQLServer.Connect("local", "sa", "daili"); oBackup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database; oBackup.Database = "medicine"; oBackup.Files = @"E:\88789\医学\" + filename; oBackup.BackupSetName = "medicine"; oBackup.BackupSetDescription = "数据库备份"; oBackup.Initialize = true; oBackup.SQLBackup(oSQLServer); if (dataBaseDB.AddDataBase(filename)) { Response.Write(dataBaseDB.clew("数据库备份成功!", "/admin/database/databaseList.aspx")); } else { Response.Write(dataBaseDB.clew("数据库备份失败!", "/admin/database/databaseList.aspx")); } } catch (Exception ex) { throw ex; } finally { oSQLServer.DisConnect(); } }