2
Answers

Updating database

Ask a question
frank

frank

14y
2.3k
1

I'm working on a form that gives the user the ability to edit a database record.
I have a gridview on a separate form that has an edit button.  When clicked, the listing form closes and the edit form opens.
Edit form has 5 fields, 4 textboxes and 1 combobox, each are bound to the relevent column in the strongly typed dataset that I added to the form.  The data is bound to the controls fine, I'm just missing something to update the changes to the database.
Not exactly sure why the records not getting updated with the below code...I'm missing something, can anyone help?

 
 
// Validate the fields

if (!isValidData())
{
MessageBox.Show("All fields are required, please try again");
}
else
{
residenceMasterTableAdapter.Update(communityDataSet.ResidenceMaster);
residenceMasterTableAdapter.Update(communityDataSet);
// Close the form reshow the frmListUnits
this.Close();
// Open up the list units form
frmListUnits myForm = new frmListUnits();
myForm.Show();
}

Any thoughts?

Thanks,
Frank
 

Answers (2)