linq - When aggregating C# datasets, how do I convert a DataSet into an DataTable Array for .Load()? -


i using .net 4.0. i'm trying aggregate many datasets identical schemas single dataset. each source dataset should contain same 3 tablenames other datasets. now, may assume data unique, across tables , datasets. i'm trying use .load() function stuck on third parameter. may misunderstanding .load() intended for, , if isn't best way accomplish task, means let me know. here's have far:

private accessfilecollection accessfilecollection; private dataset allaccessdata;  public void aggregatecollection() {     foreach (accessfile accessfile in accessfilecollection.files.values)     {         foreach (datatable dt in accessfile.dataset.tables)         {             if (allaccessdata.tables[dt.tablename] == null)             { allaccessdata.tables.add(new datatable(dt.tablename)); }         }         allaccessdata.load(accessfile.dataset.createdatareader(),              loadoption.preservechanges,             accessfile.dataset.tables);     } }  //accessfilecollection custom class implements .getenumerator() , contains: private dictionary<int, accessfile> accessfilecollection; //with get/set called ".files"  //accessfile custom class contains: private dataset ds; //with get/set called ".dataset" 

msdn gives method signature of .load():

public void load(     idatareader reader,     loadoption loadoption,     params datatable[] tables // <-- how satisfy this? provide out of accessfile? ) 

so, questions again are: - .load() appropriate here? - best way satisfy datatable[] requirements? - why doesn't microsoft let me throw entire dataset third parameter? dataset contains list of datatable arrays!

  • what best way satisfy datatable[] requirements?

a dataset contains datatables. can try tablesarray bellow (having dataset accessfile)

datatablecollection tablecollection = accessfile.tables; datatable[] tablesarray = null; tablecollection.copyto(tablesarray, 0); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -