none
Update DataSet With Add Rows From Another Dataset RRS feed

  • Question

  • hi
    I have one public DataSet
    and one loop

    DataSet PublicDataSet=new DataSet();
    while(i){

    string Select="Select * From Tbl_Person Where Code="+i;

    DataSet LocalDataset=new DataSet();

    Da.Fill(LocalDataset,"Tbl");

    //At this line I will add LocalDataSet Content To one table of PublicDataSet, but I dont Know How I can do it.!!!!!

    LocalDataset.Clear();

    i++;
    }

    Thank you

    Friday, July 10, 2009 9:36 AM

Answers

  • use
    PublicDataSet.tables.Add(LocalDataSet.Tables(0)) (if you want every localdatasetcontent in different datatables)
    or 
    PublicDataSet.Merge(LocalDataSet) (if you want all localdata content in a single datatable)

    Friday, July 10, 2009 2:21 PM
  • Why are you looping i? How do you get out? Just query all from Tbl_person that is what you eventually do in your loop anyway then copy the dataset.



    DataSet newDataSet = LocalDataSet.Copy();

    Friday, July 10, 2009 2:45 PM

All replies

  • use
    PublicDataSet.tables.Add(LocalDataSet.Tables(0)) (if you want every localdatasetcontent in different datatables)
    or 
    PublicDataSet.Merge(LocalDataSet) (if you want all localdata content in a single datatable)

    Friday, July 10, 2009 2:21 PM
  • Why are you looping i? How do you get out? Just query all from Tbl_person that is what you eventually do in your loop anyway then copy the dataset.



    DataSet newDataSet = LocalDataSet.Copy();

    Friday, July 10, 2009 2:45 PM