[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6841
  • Last Modified:

How can I add a DataTable to a Dataset

I have an existing DataTable that was populated via a method that passes in a datatable.

How can I then add that Datatable with its existing data to a Dataset...

Or perhaps a better way would be to add a new datatable to Dataset and populatate that datatable with the method called from the other class. Not sure how to do either.

Here are the basics.

there is a method in a class

omni.bll.AppsBLL getsap = new omni.bll.AppsBll();

If I was just goign to fill a Datatable I would  do the following

DataTable dt = new DataTable ();
dt = getsap.vwSap();

But I need to have that DataTable in a Dataset...not sure what I need to do here.
0
Prysson
Asked:
Prysson
1 Solution
 
TSmoothCommented:
If you have a DataSet ds then it's simply:
ds.Tables.Add(dt);

Open in new window

0
 
burakiewiczCommented:

DataSet ds = new DataSet();
ds.Tables.Add(dt);
0
 
Jonez176Commented:

DataSet ds = new DataSet();
ds.Tables.Add(myDataTable);

Open in new window

0
 
AUmidhCommented:
omni.bll.AppsBLL getsap = new omni.bll.AppsBll();
DataSet dataSet=new DataSet();    // if you have your own created before this... then use that.
DataTable dt = getsap.vwSap();
dataSet.Tables.Add(dt);
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now