public bool BackupDB(string fileName) { bool result; try { if (_DbHelper.RunQuery(new SqlConnection(Common.ConnectionString), "BACKUP DATABASE " + GetDBName() + " TO DISK = '" + fileName + "'")) { result = true; } else { result = false; } } catch (Exception ex) { return(false); } return(result); }
public bool RunQuery(string Query, string Connection) { DbConnection sqlCn = Common.CreateConnection(Connection); sqlCn.Open(); MSSqlHelper msSqlHelper = new MSSqlHelper(); try { return(msSqlHelper.RunQuery(sqlCn, Query)); } catch (Exception ex) { throw new Exception(String.Format("SYS_CategoryManager RunQuery: {0}", ex.Message)); } finally { sqlCn.Close(); } }