且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C#在Winforms中更新数据库中的DataGridview数据

更新时间:2023-10-15 09:11:22

1)您是否在foreach (DataGridViewRow row in dataGridView1.Rows)行上设置了断点并逐步执行代码以确保您甚至尝试编写更新超过一排?
2)您应该将查询稍微更改为update customer set Address=@address where Name1=@name或使用其他列作为行选择器.
1) Have you set a breakpoint on the foreach (DataGridViewRow row in dataGridView1.Rows) row and stepped through the code to ensure that you are even attempting to write updates for more than one row?
2) You should change your query a bit to update customer set Address=@address where Name1=@name or use a different column as the row selector.