C#多条件查出来的多个DataSet,然后循环将数据整合
private list<string> barlist;
public list<string> barlist
{
get { return barlist; }
set { barlist = value; }
}
dataset dt = new dataset();
dataset dt2 = null;
foreach (string data in help.barlist )
{
dt = dboperatorstd.getdataset("select xxx from xxx where xxx='" + data + "'");
if (dt2 == null)
{
dt2 = dt.copy();
}
else
{
foreach (datarow dtrow in dt.tables[0].rows)
{
datarow m_nrow = null;
m_nrow = dt2.tables[0].newrow();
foreach (datacolumn dccol in dt2.tables[0].columns)
{
m_nrow[dccol.columnname] = dtrow[dccol.columnname];
}
dt2.tables[0].rows.add(m_nrow);
}
}
}