Transaction in dataset: TableAdapterManager

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top