我在我的asp.net webapp中有sql查詢,結果存儲在datareader中。數據記錄器中的每一行都包含10列。我想用這些數據填充表格。但是,我不知道如何循環訪問數據記錄器中的列。我需要像這樣的東西:asp.net sql datareader按列循環
while (vysledky.Read())
{
TableRow row = new TableRow();
tab.Controls.Add(row);
foreach (column in ((datareader(row))) //it is not real code
{
TableCell cell = new TableCell();
cell.Text = datareader(row).content;
row.Controls.Add(cell);
}
}
我希望你明白了。由於
謝謝,這正是我所需要的 – polohy 2012-02-09 17:59:43