标签:ar 数据 on new as table return c# class
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="strWhere">筛选的条件</param> /// <returns></returns> public DataTable SreeenDataTable(DataTable dt,string strWhere) { if(dt.Rows.Count<=0)return dt; //当数据为空时返回 DataTable dtNew = dt.Clone(); //复制数据源的表结构 DataRow[] drs = dt.Select(strWhere); //strWhere条件筛选出需要的数据! if (drs.Length > 0) //判断是否存在符合的数据、为下面copy,不然报错 dtNew = drs.CopyToDataTable(); //copy到新的datatable中! return dtNew; }
标签:ar 数据 on new as table return c# class
原文地址:http://my.oschina.net/ind/blog/337836