DataSet 中的数据排序 及 DataRow装成DataTable

1、DataSet 中的数据排序

  DataSet ds = new DataSet();

            // 获取当前排口的数据
            ds = _xiaobill.GetHistoryData(yinZiBianm, zhanDian, beginDate, endDate, dNum);

            DataTable dt = ds.Tables[0];

            DataRow[] dt2 = dt.Select("1=1","数据时间 ASC ");

 

DataRow[]装成DataTable

  DataSet dsCheckList = _yinziBill.SearchJianKongYinZiByType(zhanDian);
            DataRow[] dr = dsCheckList.Tables[0].Select("因子国际编码 in ('B02','01','02','03','04')");

            DataTable t = dsCheckList.Tables[0].Clone();
            t.Clear();

            foreach (DataRow row in dr)
            {
                t.ImportRow(row);
            }

            this.CheckBoxList1.DataSource = t;
            this.CheckBoxList1.DataValueField = "因子ID";
            this.CheckBoxList1.DataTextField = "因子名称";
            this.CheckBoxList1.DataBind();

 

posted @ 2015-12-11 12:02  幽冥狂_七  阅读(529)  评论(0编辑  收藏  举报