代碼如下:
復制代碼 代碼如下:
void Page_Load(object o
DataTable dt = GetData(); //assume GetData returns the DataTable
//probably better to use Hashtable for depts and months too
string sSeparator = ":";
ArrayList alDept = new ArrayList(); //種類
ArrayList alMonth = new ArrayList(); //代碼
Hashtable ht = new Hashtable();
foreach (DataRow dr in dt
{
string sDept = dr["c"]
string sMonth
//將產地代碼轉換為產地名稱
string sMonth = GetData
if (!alDept
alDept
if (!alMonth
alMonth
ht[sDept+ sSeparator + sMonth] = dr["a"];
}
TableRow tr = new TableRow();
TableCell tc = new TableCell();
//tc
//tr
foreach (string sDept in alDept)
{
int i=
foreach (string sMonth in alMonth)
{
if(ht[sDept+ sSeparator + sMonth]==null)
{
i=i+
}
else
{
i = i + int
}
}
tc = new TableCell();
tc
tr
}
/**//*foreach (string sDept in alDept)
{
tc = new TableCell();
tc
tr
} */
Table
foreach (string sMonth in alMonth)
{
tr = new TableRow();
/**//*tc = new TableCell();
tc
tr
foreach (string sDept in alDept)
{
tc = new TableCell();
if(ht[sDept+ sSeparator + sMonth]==null)
{
tc
}
else
{
tc
}
tr
}
Table
}
}
Web 窗體設計器生成的代碼#region Web 窗體設計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調用是 ASP
//
InitializeComponent();
base
}
/**////
/// 設計器支持所需的方法
/// 此方法的內容
///
private void InitializeComponent()
{
this
}
#endregion
public DataTable GetData()
{
StatisticsB stat=new StatisticsB();
DataSet dataset=stat
return dataset
}
//取得名稱列表
public string GetData
{
StatisticsB stat=new StatisticsB();
return stat
}
From:http://tw.wingwit.com/Article/program/net/201311/14449.html