public List <DataFromAccess> ReadRecordsWithReadTime(DateTime readFromTime, DateTime readToTime)
        {
            _OleDbConnection = ConfigurationManager.AppSettings["OleDbConnection"];

            OleDbConnection       conn           = null;
            OleDbDataReader       readerEntryrec = null;
            List <DataFromAccess> returnDataList = new List <DataFromAccess>();

            try
            {
                conn = new OleDbConnection(@_OleDbConnection);
                conn.Open();

                #region modify by liudan 2009-08-13
                #endregion
                string queryString = "Select USERINFO.USERID,USERINFO.CardNo, CHECKINOUT.CHECKTIME, CHECKINOUT.CHECKTYPE FROM USERINFO,CHECKINOUT where CHECKINOUT.CHECKTIME>= #" +
                                     readFromTime + "# and CHECKINOUT.CHECKTIME<=#" + readToTime + "# and USERINFO.USERID=CHECKINOUT.USERID order by CHECKINOUT.USERID";
                OleDbCommand cmd =
                    new OleDbCommand(queryString, conn);
                readerEntryrec = cmd.ExecuteReader();

                while (readerEntryrec.Read())
                {
                    DataFromAccess data = new DataFromAccess();
                    data.CardNo = Convert.ToString(readerEntryrec["CardNo"]);
                    data.IOTime = Convert.ToDateTime(readerEntryrec["CHECKTIME"]);
                    InOutStatusEnum statusEnum = InOutStatusEnum.Out;
                    string          ioStatus   = Convert.ToString(readerEntryrec["CHECKTYPE"]);
                    //进出状态 0为进 1为出
                    if (ioStatus.Equals("I"))
                    {
                        statusEnum = InOutStatusEnum.In;
                    }
                    data.InOrOut = statusEnum;
                    returnDataList.Add(data);
                }
                return(returnDataList);
            }
            catch (Exception ex)
            {
                // 错误信息
                strErrorMsg = "异常:\n" + ex.Message;
                //// 写日志
                TLineEventLog el = new TLineEventLog();
                el.DoWriteEventLog(strErrorMsg, EventType.Error);
                return(returnDataList);
            }
            finally
            {
                if (readerEntryrec != null)
                {
                    readerEntryrec.Close();
                }
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
        public List <DataFromAccess> ReadRecords(DateTime lastReadTime)
        {
            _OleDbConnection = ConfigurationManager.AppSettings["OleDbConnection"];

            OleDbConnection       conn           = null;
            OleDbDataReader       readerEntryrec = null;
            List <DataFromAccess> returnDataList = new List <DataFromAccess>();

            try
            {
                //User Id=staples\wang.yueqi;Password=yueqiwang;
                //Jet OLEDB:Database Password=databasepw;
                //ConnectionIP();
                conn = new OleDbConnection(@_OleDbConnection);
                conn.Open();

                #region modify by liudan 2009-08-13
                //OleDbCommand cmd =
                //    new OleDbCommand("Select * FROM entryrec where entry_dt >= #" +
                //    lastReadTime + "# order by Card_No", conn);
                //readerEntryrec = cmd.ExecuteReader();

                //while (readerEntryrec.Read())
                //{
                //    DataFromAccess data=new DataFromAccess();
                //    data.CardNo = Convert.ToString(readerEntryrec[_Card_No]);
                //    string s = (readerEntryrec[_IO]).ToString();

                //    int i = Convert.ToInt32(readerEntryrec[_IO]);
                //    //进出状态 0为进 1为出
                //    if (i == 1)
                //    {
                //        data.InOrOut = InOutStatusEnum.In;
                //    }
                //    else
                //    {
                //        data.InOrOut = InOutStatusEnum.Out;
                //    }
                //    data.IOTime = Convert.ToDateTime(readerEntryrec[_IOTime]);
                //    returnDataList.Add(data);
                //}
                //return returnDataList;
                #endregion
                string queryString = "Select USERINFO.USERID,USERINFO.CardNo, CHECKINOUT.CHECKTIME, CHECKINOUT.CHECKTYPE FROM USERINFO,CHECKINOUT where CHECKINOUT.CHECKTIME>= #" +
                                     lastReadTime + "# and USERINFO.USERID=CHECKINOUT.USERID order by CHECKINOUT.USERID";
                OleDbCommand cmd =
                    new OleDbCommand(queryString, conn);
                readerEntryrec = cmd.ExecuteReader();

                while (readerEntryrec.Read())
                {
                    DataFromAccess data = new DataFromAccess();
                    data.CardNo = Convert.ToString(readerEntryrec["CardNo"]);
                    data.IOTime = Convert.ToDateTime(readerEntryrec["CHECKTIME"]);
                    InOutStatusEnum statusEnum = InOutStatusEnum.Out;
                    string          ioStatus   = Convert.ToString(readerEntryrec["CHECKTYPE"]);
                    //进出状态 0为进 1为出
                    if (ioStatus.Equals("I"))
                    {
                        statusEnum = InOutStatusEnum.In;
                    }
                    data.InOrOut = statusEnum;
                    returnDataList.Add(data);
                }
                return(returnDataList);
            }
            catch (Exception ex)
            {
                // 错误信息
                strErrorMsg = "异常:\n" + ex.Message;
                //// 写日志
                TLineEventLog el = new TLineEventLog();
                el.DoWriteEventLog(strErrorMsg, EventType.Error);
                return(returnDataList);
            }
            finally
            {
                if (readerEntryrec != null)
                {
                    readerEntryrec.Close();
                }
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }