The problem is that the data Adapter is calling acceptchanges on each row as
it's updated. It's actually by desing. In the 2.0 Framework, there's a data
adapter property called AcceptChangesDuringUpdate that you can set to
false, call your update, and where you call commit, call
DataSet.AcceptChanges.
http://www.knowdotnet.com/articles/a...ingupdate.html http://msmvps.com/williamryan/archiv...7/10/9888.aspx
In the meantime you can use GetChanges
DataSet ds1 = Table1sDataSet.GetChanges();
DataSet ds2 = Table2DataSet.GetChanges();
try
{
da1.Update(ds1.Tables[0]);
da2.Update(ds2.Tables[0]);
Trans.Commit();
OriginalDataSet1.AcceptChanges();
OriginalDataSet2.AcceptChanges();
}
catch (SqlException ex)
{
foreach(SqlError er in ex.Errors){
//Build your error message
}
Trans.rollback();
}
"Joăo Santa Bárbara" <jo****@i24portugal.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
Hi all
i have this problem .
i have 2 tables ( they are not master detail ) 2 simple tables, and i´m
doing a simple update just like this
try
Trans = Con.BeginTransaction
..........
DataAdpater1.Update(Table1) -> '10 rows Inserted in DataBase
DataAdapter2.Update(Table2) -> '10 rows Inserted in DataBase Sucess and
10 Unsucess
Trans.commit
cacth ex as exception
Trans.rollback
end try
Every Time i have an error i will run this code again ... and in the first
time i have done the rollback but in the second time all the records that
have been inserted ( in the first time ) are not inserted in the 2 time.
i saw all rows in the datatable and the row state is Unchanged when they
suposed to be Added ..
can someone help me .. ?
thks
JSB