4,820
社区成员
发帖
与我相关
我的任务
分享
public static DataSet GetDataSet()
{
List<Packet> lpc = new List<Packet>();
DataSet ds = new DataSet();
lpc = Form1.lpro;
DataTable dsTable = new DataTable();
DataColumn Time = new DataColumn("时间");
DataColumn Count = new DataColumn("数量");
dsTable.Columns.Add(Time);
dsTable.Columns.Add(Count);
ds.Tables.Add(dsTable);
DataRow[] dataRow = new DataRow[lpc.Count];
for (int i = 0; i < lpc.Count; i++)
{
dataRow[i] = dsTable.NewRow();
dataRow[i][0] = lpc[i].Time;
dataRow[i][1] = lpc[i].Count;
dsTable.Rows.Add(dataRow[i]);
}
return ds;