将一个DataTable转变为自定义的DataSet
public DataSetUser SettingDs(DataSetUser ds,DataTable tb)
{
DataTable Dstable = ds.Tables[0];
for (int i = 0; i < tb.Rows.Count; i++)
{
DataRow row = Dstable.NewRow();
for (int j = 0; j < tb.Columns.Count; j++)
{
string str = tb.Columns[j].ToString();
row[str] = tb.Rows[i][str];
}
Dstable.Rows.Add(row);
}
return ds;
}
转载于:https://www.cnblogs.com/shj0633/archive/2007/01/13/619569.html