日期:2014-05-17  浏览次数:20944 次

求助dataset,如何从dataset中检索数据再写入另外一个dataset中
rt
肿么样才能从从dataset中检索数据再写入另外一个dataset中

------解决方案--------------------
C# code

    DataSet copyDataSet=new DataSet ();//copyDataSet表示目标DataSet 
    copyDataSet.Tables.Add(dataSet.Tables[0].Select(" id>5,Name='Chinajiyong'"));//dataSet表示源DataSet ,dataSet.Select(" id>5")表示选择id字段值大于5且Name='Chinajiyong'的数据

------解决方案--------------------
探讨

C# code

DataSet copyDataSet=new DataSet ();//copyDataSet表示目标DataSet
copyDataSet.Tables.Add(dataSet.Tables[0].Select(" id>5,Name='Chinajiyong'"));//dataSet表示源DataSet ,dataSet.Select(" id>5"……

------解决方案--------------------
我只会填充数据集读取表。。。up楼上
------解决方案--------------------
检索条件可变是什么意思?

C# code

string sWhere=检索的where条件
copydataset.tables.add(dataSet.Tables[0].Select(sWhere));)

------解决方案--------------------
dataset.Tables.Count 来循环 再放到 别的dataset里。。
比如,
C# code
DataSet ds = new DataSet();
            for (int i = 0; i < ds.Tables.Count; i++)
            {
 
            }

------解决方案--------------------
补充:
 ds.Tables.Add
------解决方案--------------------
探讨
C# code


DataSet copyDataSet=new DataSet ();//copyDataSet表示目标DataSet
copyDataSet.Tables.Add(dataSet.Tables[0].Select(" id>5,Name='Chinajiyong'"));//dataSet表示源DataSet ,dataSet.Select(" id……