using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using Maticsoft.DBUtility;
using System.Data.SQLite;

namespace Jpsoft.DAL
{
    public class BaseClass
    {
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="TableName">表名称</param>
        /// <param name="Column">查询列</param>
        /// <param name="PageIndex">索引号</param>
        /// <param name="PageSize">页面大小</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="OrderBy">排序</param>
        public DataSet SelectPage(string TableName, string Column, int PageIndex, int PageSize, string strWhere, string OrderBy)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(string.Format("select {0} from {1} ", Column, TableName));
            if (!string.IsNullOrWhiteSpace(strWhere))
            {
                strSql.Append(" where " + strWhere);
            }
            if (!string.IsNullOrWhiteSpace(OrderBy))
            {
                strSql.Append(" order by " + OrderBy);
            }
            strSql.Append(string.Format(" limit {0},{1}", PageSize * PageIndex, PageSize));
            return DbHelperMySQL.Query(strSql.ToString());
        }
    }
}
