Ejemplo n.º 1
0
        //历史数据 查询
        public static DataTable GetHistoricData(DateTime TheBegin, DateTime TheEnd, string tableName)
        {
            string begin = TheBegin.ToString("yyyy-MM-dd HH:mm:ss");
            string end   = TheEnd.ToString("yyyy-MM-dd HH:mm:ss");
            string sql   = string.Format("select * from {0} where ( Dtime>#{1}# and Dtime<#{2}# ) order by Dtime", tableName, begin, end);

            return(AccessDbHelper.ExecuteSql_GetTable(sql));
        }
Ejemplo n.º 2
0
        //历史事件 查询
        public static DataTable GetAlermHistoricEvent(DateTime BeginTime, DateTime EndTime)
        {
            string    begin      = BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
            string    end        = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
            string    sql        = string.Format("select * from Alarm_History_Table where ( SaveTime>#{0}# and SaveTime<#{1}# ) order by SaveTime desc", begin, end);
            DataTable AlarmTable = AccessDbHelper.ExecuteSql_GetTable(sql);

            if (AlarmTable != null && AlarmTable.Columns.Count > 0)
            {
                //移除不相关的列
                AlarmTable.Columns.Remove("KeyId");
                //修改表格 列名
                AlarmTable.Columns["MessageStr"].ColumnName = Model_Data.Language.Desc.EventInfo;
                AlarmTable.Columns["SaveTime"].ColumnName   = Model_Data.Language.Desc.EventTime;
            }
            return(AlarmTable);
        }