我是在運行時先對table1進行數據填充再對table2進行數據填充,主要代碼如下:
private void FillTable()
{
FillTable1();
FillTable2();
}
private void FillTable1()
{
while(drTh.Read())
{
TableRow row=new TableRow();
TableCell cell = new TableCell();
cell.Text=drTh["ph"].ToString();
row.Cells.Add(cell);
cell=new TableCell();
cell.Text =drTh["khph"].ToString();
row.Cells.Add(cell);
Tchuhuodanmx.Rows.Add(row);
}
drTh.Close();
}
private void FillTable2()
{
while(drChh.Read())
{
TableRow row=new TableRow();
TableCell cell = new TableCell();
cell.Text=drChh["ph"].ToString();
row.Cells.Add(cell);
Ttuihuodanmx.Rows.Add(row);
}
drChh.Close();
}
private void FillTable()
{
FillTable1();
FillTable2();
}
private void FillTable1()
{
while(drTh.Read())
{
TableRow row=new TableRow();
TableCell cell = new TableCell();
cell.Text=drTh["ph"].ToString();
row.Cells.Add(cell);
cell=new TableCell();
cell.Text =drTh["khph"].ToString();
row.Cells.Add(cell);
Tchuhuodanmx.Rows.Add(row);
}
drTh.Close();
}
private void FillTable2()
{
while(drChh.Read())
{
TableRow row=new TableRow();
TableCell cell = new TableCell();
cell.Text=drChh["ph"].ToString();
row.Cells.Add(cell);
Ttuihuodanmx.Rows.Add(row);
}
drChh.Close();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货