错误:foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.Table' because 'System.Web.UI.WebControls.Table' does not contain a public definition for 'GetEnumerator'
foreach (TableRow tr in table)
{
...
}
修改为
foreach (TableRow tr in table.Rows)
{
...
}