Database.UpdateDataSet()...

Topics: Data Access Application Block
Oct 12, 2007 at 10:50 AM
We use “Database.UpdateDataSet()” function to update some tables’ data ,these tables embedded in one Transaction. When one table’s data occurrence Mistake, we hope other table’s row status keeps original status.

thanks.
Oct 12, 2007 at 2:42 PM
Hi,


mhw wrote:
We use “Database.UpdateDataSet()” function to update some tables’ data ,these tables embedded in one Transaction. When one table’s data occurrence Mistake, we hope other table’s row status keeps original status.


I'm not sure I understand what your request is. Do you get an unexpected behavior?

Fernando
Oct 13, 2007 at 3:09 AM
Yes. I'm use
"public int UpdateDataSet( DataSet dataSet, string tableName, DbCommand insertCommand, DbCommand updateCommand, DbCommand deleteCommand, DbTransaction transaction )"
Code:
DataSet dsTemp //include 3 tables(T1,T2,T3) ,3 rows in every table and T1(T2,T3).Rowsi.RowState == DataRowState.Added
//Database db;
//IDbTransaction tran;
try {
int effectRowsNumber = db.UpdateDataSet(dsTemp,"T1",insertCommand,null,null,(DbTransaction)tran) //success
effectRowsNumber = db.UpdateDataSet(dsTemp,"T2",insertCommand,null,null,(DbTransaction)tran) //success
effectRowsNumber = db.UpdateDataSet(dsTemp,"T3",insertCommand,null,null,(DbTransaction)tran) //fail
}
catch{
throw;
}
then dsTemp.Tables's rowState:
dsTemp.Tables"T1".Rowsi.RowState == DataRowState.Unchanged
dsTemp.Tables"T2".Rowsi.RowState == DataRowState.Unchanged
dsTemp.Tables"T3".Rowsi.RowState == DataRowState.Added

I hope table's row status keeps original status(DataRowState.Added or DataRowState.Modified).

thanks.