I am developing a C# windows form application. This simple application is basically a form where the user can save, edit and delete some data in a MS Access database. When I debug the code, it works properly (I save the data end it appears as a new line in datagridview). The problem is that when I close the form and open it again, the datagridview do not show the record I just saved, and the new record is not saved in MS Access database. Here is the code I using to save the record:
private void btnSalvar_Click(object sender, EventArgs e)
{
try
{
materiaisBindingSource.EndEdit();
materiaisTableAdapter.Update(this.appData.Materiais);
this.appData.Materiais.AcceptChanges();
groupBox1.Enabled = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Error);
materiaisBindingSource.ResetBindings(false);
}
}
Please, can someone help me?