首页新闻找找看学习计划

dataset

0
悬赏园豆:5 [已解决问题] 解决于 2012-09-18 12:14

一个DataSet数据集 在这个数据集中如何把两条数据,作为一条数据添加到集合中.

liyongchao1002的主页 liyongchao1002 | 菜鸟二级 | 园豆:202
提问于:2012-09-17 17:34
< >
分享
最佳答案
0
ds.Tables[0].Columns.Add("NewItem");
foreach (DataRow dr in ds.Tables[0].Rows)
{
       dr["NewItem"] = dr["Item1"].ToString()+dr["Item2"];
}
收获园豆:5
田林九村 | 老鸟四级 |园豆:2367 | 2012-09-17 21:26

                  var rows = _dsNotClass.Tables[0].Rows.Count;

                        var k = rows / 3; //除以行数
                        var p = rows % 3; //余数
                        var m = 0;

                        for (int j = 0; j < k; j++)
                        {
                            for (int g = 0; g < 3; g++)
                            {
                                m = g + 3 * j;
                                strXJH += "," + _dsNotClass.Tables[0].Rows[m]["XJH"].ToString();
                            }
                            list_xjh.Add(strXJH);

                            strXJH = "";
                        }
                        if (p != 0)
                        {
                            for (int q = 0; q < p; q++)
                            {
                                m = 3 * k + q;
                                strXJH += "," + _dsNotClass.Tables[0].Rows[m]["XJH"].ToString();
                            }
                            list_xjh.Add(strXJH);
                            strXJH = "";
                        }

liyongchao1002 | 园豆:202 (菜鸟二级) | 2012-09-18 12:17
其他回答(1)
0

没懂,你问什么 

哇~怪兽 | 园豆:603 (小虾三级) | 2012-09-17 17:38

DataSet数据集 在这个数据集中如何把两条数据,合并为一条数据添加到集合中

支持(0) 反对(0) liyongchao1002 | 园豆:202 (菜鸟二级) | 2012-09-17 19:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册