我有一个C#的删除代码请问哪里错了?
private void button2_Click(object sender, System.EventArgs e){
//删除数据
try
{
if(MessageBox.Show(this,"你真的要删除这一行吗?","删除数据",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
{
this.oleDbConnection1.Open();
this.dataSet51.Tables[0].Rows[int.Parse(this.label4.Text)-1].Delete();
this.oleDbDataAdapter1.Update(this.dataSet51);
this.dataSet51.AcceptChanges();
this.oleDbConnection1.Close();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}