Fill a DataSet with a DataTable

  • Thread starter Thread starter DraguVaso
  • Start date Start date
D

DraguVaso

Hi,

In my VB.NET-application I manually fill a DataTable with records from a
file. After that I want to put it into a DataSet.
Does anybody knows how to do this?

I tried thinks like: MyDataSet("MyTable") = MyDataTable but this doesn't
work :-/

Thanks a lot in advance!

Pieter
 
MyDataSet.Tables.Add(MyDataTable);

You can reference that datatable using similar technique....

DataTable dt = new DataTable();
DataSet myDataSet = new DataSet();

myDataSet.Tables.Add(dt);

myDataSet.Tables[0] = MyDataTable;//where Tables[0] = dt

Is this what you're asking? If not, let me know and I'll give it another
try.

HTH,

Bill

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Thanks! I should have known it myself :-(

William Ryan eMVP said:
MyDataSet.Tables.Add(MyDataTable);

You can reference that datatable using similar technique....

DataTable dt = new DataTable();
DataSet myDataSet = new DataSet();

myDataSet.Tables.Add(dt);

myDataSet.Tables[0] = MyDataTable;//where Tables[0] = dt

Is this what you're asking? If not, let me know and I'll give it another
try.

HTH,

Bill

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
DraguVaso said:
Hi,

In my VB.NET-application I manually fill a DataTable with records from a
file. After that I want to put it into a DataSet.
Does anybody knows how to do this?

I tried thinks like: MyDataSet("MyTable") = MyDataTable but this doesn't
work :-/

Thanks a lot in advance!

Pieter
 
Back
Top