Beispiel #1
0
        /// <summary>
        /// 摘要:根据条件查询数据集
        /// </summary>
        /// <param name="dataSetSql">查询语句(包括列名、表等信息,支持表关联)</param>
        /// <param name="where">条件组,二维数据【0】为包括字段名的语句段模板,【1】为取值</param>
        /// <param name="orderByColumn">排序列,二维数据【0】为字段名,【1】为ASC(升序)或DESC(降序)</param>
        /// <returns></returns>
        public override DataTable GetDataSet(string dataSetSql, List <string[]> where, List <string[]> orderByColumn)
        {
            string        stCmd     = dataSetSql + "{1} {0}";
            string        stOrderby = ConstructOrderBy(orderByColumn);
            List <string> para      = new List <string>();
            List <object> value     = new List <object>();
            string        stWhere   = ConstructWhere(where, out para, out value);

            if (where.Count == 0)
            {
                stCmd = string.Format(stCmd, string.IsNullOrEmpty(stOrderby) ? "" : "Order by " + stOrderby, "");
            }
            else
            {
                stCmd = string.Format(stCmd, string.IsNullOrEmpty(stOrderby) ? "" : "Order by " + stOrderby, " where " + stWhere);
            }

            return(ExecuteSql.ExeParaSqlForDataSetAccess(stCmd, para, value).Tables[0]);
        }