遍历 DataSet

DataSet ds=new DataSet ;
//获取dataset的第一张table,取其他table只须改下标
DataTable dt=ds.tables[0];
//遍历行
foreach(datarow dr in dt.rows)
{
//遍历列
for(int i=0;i<dt.columns.count;i++)
{
response.write(dr[i].tostring();
}
response.write("<br />");
}

 

posted @ 2015-09-14 21:49  请叫我七哥  阅读(509)  评论(0编辑  收藏  举报