Transaction in dataset: TableAdapterManager

  • Thread starter Thread starter Jay Pabs
  • Start date Start date
J

Jay Pabs

After a long hour of research on how to make dataset transactional I
am not still satisfied with the results. Currently I have setup a
transaction for every command in my dataset like:

Partial Public Class OrdersTableAdapter
Public Sub AssignConnection(ByVal conn As
SqlClient.SqlConnection, Optional ByVal trans As
SqlClient.SqlTransaction = Nothing)
Me.Connection = conn

If trans IsNot Nothing Then
Me.Adapter.InsertCommand.Transaction = trans
Me.Adapter.DeleteCommand.Transaction = trans
Me.Adapter.UpdateCommand.Transaction = trans
End If

Me.Adapter.AcceptChangesDuringUpdate = False

Me.Adapter.ContinueUpdateOnError = False
End Sub
End Class

This is working but if I have so many Table (like one to many
relationship) in my dataset I have to create every transaction and
update it one by one like:

Me.OrdersTableAdapter.Update(Me.OrdersDataSet.Orders)
Me.OrderDetailsTableAdapter.Update(Me.CustomersDataSet.OrderDetails)

What I want is the same functionality as VB.NET 2008 to update all
table at once using TableAdapterManager like:

Me.TableAdapterManager.UpdateAll(Me.OrdersDataSet)

Anyone know how to do this?
 
Back
Top