Mike Hildner
Sep 8th, 2004, 03:49 PM
I have a form with some text boxes, bound to a table in a DataSet. I can create a new row like this:
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
After moving to the new record, you enter in your new data. I'm having trouble committing the data to the DataSet (not the DB). If I click my save button, default values, not the values typed in get sent to the db. A work around is to change the BindingManagerBase.Position like this, but it doesn't seem right:
private void btnSaveAndClose_Click(object sender, System.EventArgs e)
{
// Cheezy hack to commit the new record
btnNext_Click(null, null); // Moves to the last record of the table.
// End cheezy hack
statusBar1.Text = "Updating...";
DataSet changes = ds.GetChanges();
.
.
.
Is there a better way to commit the changes to the DataSet?
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
After moving to the new record, you enter in your new data. I'm having trouble committing the data to the DataSet (not the DB). If I click my save button, default values, not the values typed in get sent to the db. A work around is to change the BindingManagerBase.Position like this, but it doesn't seem right:
private void btnSaveAndClose_Click(object sender, System.EventArgs e)
{
// Cheezy hack to commit the new record
btnNext_Click(null, null); // Moves to the last record of the table.
// End cheezy hack
statusBar1.Text = "Updating...";
DataSet changes = ds.GetChanges();
.
.
.
Is there a better way to commit the changes to the DataSet?