S
Sam
When using a datagrid on a simple form I get another entry that is exaclty
the same to be inserted. The actual database values are correct (no
duplication). Why is the datagrid showing me two of the same records even if
the database has one correct insert. It is driving me insane. I checked the
following:
I checked my insertcommand statement and it is working exaclty like a new
dataform that I created which is functioning correctly.
I checked the ds object and dataadapter objects' properties and the form
that works with the table has the same properties.
If I refresh or reload the dataset the datagrid shows everything correctly.
Its only when I run the following that the duplication shows in the
datagrid. And again I noticed this wasn't happening on a form that I newly
created using the wizard ( I basically modified my version for checking rows
and other stuff)
if ((objDataSetChanges != null))
{
try
{
// There are changes that need to be made, so attempt to update the
datasource by
// calling the update method and passing the dataset and any parameters.
if (MessageBox.Show("Do you want to save the changes?", "Save Changes",
MessageBoxButtons.YesNo ) == DialogResult.Yes)
{
this.UpdateDataSource(objDataSetChanges);
objdsTimesheet.Merge(objDataSetChanges);
objdsTimesheet.AcceptChanges();
}
}
catch (System.Exception eUpdate)
{
// Add your error handling code here.
throw eUpdate;
}
// Add your code to check the returned dataset for any errors that may have
been
// pushed into the row object's error.
}
the same to be inserted. The actual database values are correct (no
duplication). Why is the datagrid showing me two of the same records even if
the database has one correct insert. It is driving me insane. I checked the
following:
I checked my insertcommand statement and it is working exaclty like a new
dataform that I created which is functioning correctly.
I checked the ds object and dataadapter objects' properties and the form
that works with the table has the same properties.
If I refresh or reload the dataset the datagrid shows everything correctly.
Its only when I run the following that the duplication shows in the
datagrid. And again I noticed this wasn't happening on a form that I newly
created using the wizard ( I basically modified my version for checking rows
and other stuff)
if ((objDataSetChanges != null))
{
try
{
// There are changes that need to be made, so attempt to update the
datasource by
// calling the update method and passing the dataset and any parameters.
if (MessageBox.Show("Do you want to save the changes?", "Save Changes",
MessageBoxButtons.YesNo ) == DialogResult.Yes)
{
this.UpdateDataSource(objDataSetChanges);
objdsTimesheet.Merge(objDataSetChanges);
objdsTimesheet.AcceptChanges();
}
}
catch (System.Exception eUpdate)
{
// Add your error handling code here.
throw eUpdate;
}
// Add your code to check the returned dataset for any errors that may have
been
// pushed into the row object's error.
}