public SortedDictionary <int, OperatorLogTable> getRecordFromQuerySql(string querySql) { string query = "SELECT [PKEY],[USER_NAME],[OPER_TIME],[MODULE_NAME],[OPER_DESC],"; query += "[HOST_NAME], [SYSTEM_NAME] FROM [dbo].[BASE_OPERATOR_LOG] "; query += querySql; query += "ORDER BY PKEY"; SortedDictionary <int, OperatorLogTable> dbBackupList = new SortedDictionary <int, OperatorLogTable>(); using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, query)) { foreach (DataRow row in dataTable.Rows) { OperatorLogTable record = new OperatorLogTable(); record.pkey = DbDataConvert.ToInt32(row["PKEY"]); record.userName = DbDataConvert.ToString(row["USER_NAME"]); record.operTime = DbDataConvert.ToString(row["OPER_TIME"]); record.moduleName = DbDataConvert.ToString(row["MODULE_NAME"]); record.operDesc = DbDataConvert.ToString(row["OPER_DESC"]); record.hostName = DbDataConvert.ToString(row["HOST_NAME"]); dbBackupList.Add(dbBackupList.Count, record); } } return(dbBackupList); }
private void load() { string query = "SELECT [PKEY],[USER_NAME],[OPER_TIME],[MODULE_NAME],[OPER_DESC],"; query += "[HOST_NAME], [SYSTEM_NAME] FROM [dbo].[BASE_OPERATOR_LOG] ORDER BY PKEY"; m_dbBackupList.Clear(); using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, query)) { foreach (DataRow row in dataTable.Rows) { OperatorLogTable record = new OperatorLogTable(); record.pkey = DbDataConvert.ToInt32(row["PKEY"]); record.userName = DbDataConvert.ToString(row["USER_NAME"]); record.operTime = DbDataConvert.ToString(row["OPER_TIME"]); record.moduleName = DbDataConvert.ToString(row["SYSTEM_NAME"]) + "-" + DbDataConvert.ToString(row["MODULE_NAME"]); record.operDesc = DbDataConvert.ToString(row["OPER_DESC"]); record.hostName = DbDataConvert.ToString(row["HOST_NAME"]); record.systemName = DbDataConvert.ToString(row["SYSTEM_NAME"]); m_dbBackupList.Add(m_dbBackupList.Count, record); } } }