DataTable dt = ds.Table[0];
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
dr["列名"]="你的值";
}
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
dr["列名"]="你的值";
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23109131/viewspace-680954/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23109131/viewspace-680954/
本文介绍了一种使用C#在DataTable中批量更新特定列值的方法。通过一个foreach循环遍历所有DataRow并设置指定列的值,实现了高效的数据更新。
2359

被折叠的 条评论
为什么被折叠?



