删除一条记录模块设计与实现
/// <summary>
/// 删除数据库中的一记录
/// </summary>
/// <returns></returns>
public bool deletDataGridViewOneLine(object sender, EventArgs e)
{
bool result = false;
Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected); //单选模式
int selectedRow = dataGridView1.SelectedRows[0].Index; //获得选中的某行
string MName = dataGridView1.Rows[selectedRow].Cells[0].Value.ToString().Trim();

本文介绍如何在C#的WinForm应用程序中,结合Access数据库实现记录的删除功能。通过选取数据行,弹出确认对话框,执行SQL删除语句,并处理可能出现的异常情况。
最低0.47元/天 解锁文章
531

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



