foreach (DataRow dr in ds.Tables[0].Rows) 这意思是什么 详细点啊

回答得好 会加分的
2025-05-01 08:06:59
推荐回答(2个)
回答1:

foreach:加强的for循环
ds:DataSet(可以放多个Table,也就是可以放多个表)

意思是:循环ds中第一个Table的所有行 。
不懂的话 可以继续追问我。

回答2:

foreach (DataRow dr in ds.Tables[0].Rows)

等于
for(int i=0;i{
DataRow dr=Tables[0].Rows[i];
}