Hi Matt,
First of all, great product, saved me hours (probably weeks) of work.
I have a couple of grids bound to eo's, the tables have unique keys on them on two columns.
When i violate these keys, the save method obviously raises an exception.
I trap this SQL exception and issue a warning to the user that they are a muppet, because they have entered duplicate data.
This may seem lazy, i should probably check for duplicates before saving, but anyhoo, here is the problem....
When the user subsequently changes the data to correct values, the next save raises \"DataTable already belongs to another DataSet\".
This is because you cannot have the same datatable in different datasets.
I changed the eo.save method to clear the dataset in the finally clause, as below and all now works fine, what are your thoughts on this ?
public virtual void Save()
{
if (_dataTable == null) { return; }
TransactionManager txMgr = TransactionManager.ThreadTransactionMgr();
DataSet ds = new DataSet();
try
{
..................
// Clean up resources
txMgr.CommitTransaction();
}
catch (Exception ex)
{
if (!(txMgr == null))
{
txMgr.RollbackTransaction();
txMgr.TransactionCommitted -= new TransactionManager.TransactionCommittedDelegate(this.txMgr_TransactionCommitted);
}
throw ex;
}
finally
{
ds.Tables.Clear();
}
Once again, thanks for all your efforts
Dave
