Exemple #1
0
        private void load()
        {
            string query = "SELECT [PKEY],[BACK_TYPE],[NAME],[HOST_NAME],[SAVE_PATH1],[SAVE_PATH2],[REASON],[NOTE]";

            query += ",[BACKUP_TIME],[STATE] FROM [dbo].[BASE_DB_BACKUP_RECORD] ORDER BY PKEY";

            m_dbBackupList.Clear();

            using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, query))
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    DbBackupRecordTable record = new DbBackupRecordTable();

                    record.pkey       = DbDataConvert.ToInt32(row["PKEY"]);
                    record.backType   = DbDataConvert.ToInt32(row["BACK_TYPE"]);
                    record.name       = DbDataConvert.ToString(row["NAME"]);
                    record.hostName   = DbDataConvert.ToString(row["HOST_NAME"]);
                    record.savePath1  = DbDataConvert.ToString(row["SAVE_PATH1"]);
                    record.savePath2  = DbDataConvert.ToString(row["SAVE_PATH2"]);
                    record.reason     = DbDataConvert.ToString(row["REASON"]);
                    record.note       = DbDataConvert.ToString(row["NOTE"]);
                    record.backupTime = DbDataConvert.ToString(row["BACKUP_TIME"]);
                    record.state      = DbDataConvert.ToString(row["STATE"]);

                    m_dbBackupList.Add(m_dbBackupList.Count, record);
                }
            }
        }
Exemple #2
0
        public void insert(DbBackupRecordTable record)
        {
            string sql = "INSERT INTO [dbo].[BASE_DB_BACKUP_RECORD]([BACK_TYPE],[NAME],[HOST_NAME],";

            sql += "[SAVE_PATH1],[SAVE_PATH2],[REASON],[NOTE],[STATE]) VALUES(";

            sql += "0,"; // 代表手动备份
            sql += "'" + record.name + "',";
            sql += "'" + record.hostName + "',";
            sql += "'" + record.savePath1 + "',";
            sql += "'" + record.savePath2 + "',";
            sql += "'" + record.reason + "',";
            sql += "'" + record.note + "','备份成功')";

            try
            {
                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, sql);

                load();
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }
        }