Edited:
DataTable dt = SomeMethodReturnDataTable();
YourDataSet ds = new YourDataSet();
Add DataTable into DataSet:
ds.Tables.Add(dt)
or If the columns inside
ds.Tables["A"]
is same with
dt
, then you can loop each rows and columns and load the value from
dt
into
ds.Tables["A"]
.
int c = -1;
foreach (DataRow dr in dt.Rows)
{
c++;
ds.Tables["A"].Rows.Add();
foreach (DataColumn dc in dt.Columns)
{
ds.Tables["A"].Rows[c][dc.ColumnName] = dr[dc.ColumnName];
}
}