예제 #1
0
        /// <summary>
        /// 根据标记位从库中获取一定数量的数据
        /// </summary>
        /// <param name="count"></param>
        /// <param name="dataflag"></param>
        /// <returns></returns>
        public static List <DiTu_DB> GetData(int count, int dataflag)
        {
            using (MAction action = new MAction(TableNames.dt, ConnectStr))
            {
                string     whereStr = "d=" + dataflag + " LIMIT " + count;
                MDataTable rs       = action.Select(whereStr);

                return(rs.ToList <DiTu_DB>());
            }
        }
예제 #2
0
파일: DBFast.cs 프로젝트: yanshen6/cyqdata
        /// <summary>
        /// 查找多条记录
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="pageIndex">第N页</param>
        /// <param name="pageSize">每页N条</param>
        /// <param name="where">条件</param>
        /// <param name="count">返回记录总数</param>
        /// <param name="columns">指定查询的列(可选)</param>
        /// <returns></returns>
        public static List <T> Select <T>(int pageIndex, int pageSize, object where, out int count, params string[] columns)
        {
            MDataTable dt = null;

            using (MAction action = GetMAction <T>())
            {
                if (columns != null && columns.Length > 0)
                {
                    action.SetSelectColumns(columns);
                }
                dt = action.Select(pageIndex, pageSize, where, out count);
            }
            return(dt.ToList <T>());
        }