I am trying to learn the basics of making databases in Visual C#, and I am building a basic application. In the application there is a delete button that will delete the record that is currently shown in the textboxes. The code I have at the moment is this:
private void btnDelete_Click(object sender, EventArgs e)
{
currentRow.Delete();
dAdapter.Update(dataset, "Contacts");
clearTextBoxes();
}
currentRow is the DataRow I want to delete and that which is shown in the textboxes. dataset is the Dataset. dAdapter is the DataAdapter, and “Contacts” is the table name or w/e. However this is generating an error sometimes. What’s wrong here? Thanks!
Have you set the
dAdapter.DeleteCommandproperty? Based on the error message, it sounds like this property might not be set or may be invalid.