永发信息网

为什么我的dataGridView不能更新数据和增加新行

答案:2  悬赏:0  手机版
解决时间 2021-12-25 17:22
  • 提问者网友:骨子里的高雅
  • 2021-12-24 23:30
为什么我的dataGridView不能更新数据和增加新行
最佳答案
  • 五星知识达人网友:山有枢
  • 2021-12-25 00:14
创建方法: dgGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e) string sql = string.Format("update A set a1='{0}' where id='{2}'", dgGrid.Rows[e.RowIndex].Cells["dgcolumn1"].Value, dgGrid.Rows[e.RowIndex].Cells["dgcol..
全部回答
  • 1楼网友:迟山
  • 2021-12-25 01:24
首先你要保证你的datagridview的allowusertoaddrows属性为true,这样你的最后一行始终是添加行,添加完数据后 在你的插入按钮事件里获取最后一行的数据, datagridviewrow row = datagridview1.rows[datagridview1.rows.count-2];
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯