Re: Typed Dataset and transactions in ADO.NET 2.0



You can't use transactions with a table adapter. If you want to do that,
you'll need to use a data adapter.

Dim dt as New DataTable()
Dim cn as New SqlConnection(ss)
Dim da As New SqlDataAdapter(ss, cn)
da.SelectCommand.Parameters.AddWithValue("@OrderID", 1050")
'define updating logic for sqldataadapter here (set up InsertCommand,
DeleteCommand, UpdateCommand)
cn.Open()
da.Fill(tbl)
'modify the contents
Using txn as SqlTransaction = cn.BeginTransaction()
'set the transaction property of the da's commands
da.UpdateCommand.Transaction = txn
da.SelectCommand.Transaction = txn
da.DeleteCommand.Transaction = txn

'submit the changes
da.Update(dt)
'commit the changes
txn.Commit()
End Using
cn.Close()

Robin S.
---------------------------------
"STeW" <STeW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0EBBF267-80CC-4343-AA02-458B7F148FF8@xxxxxxxxxxxxxxxx
Hi all,

I have a general question about typed datased and transaction. Do you
anybody know the best way how to manage transaction typed dataset?
Generaly,
when I create dataset and INSERT/UPDATE/DELETE command in a table
adapter,
there are connections on commands which are not in transaction.
I need to have it in transaction. I can do it programaticly. I'm
asking if
anybody knows about any property which enables code generation for
transaction support in typed dataset.

Thanks

Stepan


.



Relevant Pages

  • Re: Moving data into a new table once selected from a form
    ... Public Sub ShowTransactionOne() ... Dim ws As DAO.Workspace ... ws.CommitTrans 'end the transaction, OK ... FROM tblitems INNER JOIN tbltransactions ON tblitems.ItemID = ...
    (microsoft.public.access.queries)
  • Err "SqlConnection does not support parallel transactions"
    ... I'm getting the err "SqlConnection does not support parallel ... OleDBconnection and had the same err. ... ' establish connection to MSDE dd, start transaction ... Dim strConnectionString As String = "Persist Security ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Run-Time error 91
    ... Private Sub Command8_Click ... Dim wrk As DAO.Workspace ... Dim strSQL As String, strQuery As String, strMessage As String ... > Transaction rolled back and not tables updated.) ...
    (microsoft.public.access.formscoding)
  • RE: Archival
    ... Dim ws As DAO.Workspace 'Current workspace (for transaction). ... Dim bInTrans As Boolean 'Flag that transaction is active. ... Dim strSql As String 'Action query statements. ...
    (microsoft.public.access.formscoding)
  • Re: Primary Key Violation Error Message
    ... Dim ws As DAO.Workspace 'Current workspace (for transaction). ... Dim strSql As String 'Action query statements. ... 'Step 2: Execute the append. ...
    (microsoft.public.access.formscoding)

Loading