【发布时间】:2019-04-04 10:05:02
【问题描述】:
我有一个带有DataGridView 的 Windows 窗体表单。 DataGridView 有 DataGridViewButtonColumn,我有一个数据库(id 自动递增)。
我可以从DataGridView删除它。
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) {
if (e.ColumnIndex == Delete.Index) {
dgv.Rows.Remove(dgv.Rows[e.RowIndex]);
}
}
如何从数据库中删除它?
【问题讨论】:
-
到底是什么问题?你试过什么?您使用的是 OR 映射器吗?
-
您是否使用数据表作为数据源?然后从表中删除。
标签: c# sql-server winforms