2
Answers

Save to database

james james

james james

7y
225
1
I am trying to save form1 to a databse in form2. when I save the form2 dataridview is blank. My message box says updated.
i have (tableBindingSource) (tableTableAdapter) (tableAdapterManager) and Database(TrailerInformation).
 
 
 
 Form1
 <
private void btnSave_Click(object sender, EventArgs e)
{
try
{
this.Validate();
this.tableBindingSource.EndEdit();
this.tableTableAdapter.Update(this.trailerInformation);
MessageBox.Show("Update successful");
}
catch (System.Exception ex)
{
MessageBox.Show("Update failed");
}
}
>
 
Form2
 
<
private void tableBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
Validate();
tableBindingSource.EndEdit();
tableAdapterManager.UpdateAll(trailerInformation);
}
private void DataBase_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'trailerInformation.Table' table. You can move, or remove it, as needed.
this.tableTableAdapter.Fill(this.trailerInformation.Table);
}

Attachment: Form1.zip

Answers (2)