|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
'The transaction has aborted.'I have some code that is using ADO.NET 2.0 and TableAdapters. The code is pretty simple and I occassionally get an exception i.e. 'The transaction has aborted.'. The number of tables are actually 4 and 2 of wchich are being updated and rest two only making insertions. tbl1, tbl2, tbl3 are DataTable variables of type MyTable1, MyTable2, MyTable3 which are geneated by Visual studio for strongly typed datasets. (Code is given below). Any idea why this is happening and how it can be resolved. Thanks in advance for your help. Paraclete. using (System.Transactions.TransactionScope myTransaction = new System.Transactions.TransactionScope()) { MyDataSetTableAdapters.MyTable1TableAdapter tbl1A = new MyDataSetTableAdapters.MyTable1TableAdapter (); tbl1A.Connection = myConn; tbl1A.InsCommandTimeout = 45; tbl1A.UpdCommandTimeout = 45; tbl1A.Update(tbl1); MyDataSetTableAdapters.Table2TableAdapter tbl2A = new MyDataSetTableAdapters.Table2TableAdapter (); tbl2A.Connection = myConn; tbl2A.InsCommandTimeout = 45; tbl2A.UpdCommandTimeout = 45; tbl2A.Update(tbl2); MyDataSetTableAdapters.Table3TableAdapter tbl3A = new MyDataSetTableAdapters.Table3TableAdapter (); tbl3A.Connection = myConn; tbl3A.InsCommandTimeout = 45; tbl3A.Update(tbl3); myTransaction .Complete(); } |
|||||||||||||||||||||||