Re: Typed Dataset and transactions in ADO.NET 2.0
- From: "RobinS" <RobinS@xxxxxxxxxxxxxxx>
- Date: Mon, 8 Jan 2007 11:00:56 -0800
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
.
- Follow-Ups:
- Re: Typed Dataset and transactions in ADO.NET 2.0
- From: John Sitka
- Re: Typed Dataset and transactions in ADO.NET 2.0
- Prev by Date: Re: What's My Password?
- Next by Date: Re: What's My Password?
- Previous by thread: Connection timeout
- Next by thread: Re: Typed Dataset and transactions in ADO.NET 2.0
- Index(es):
Relevant Pages
|
Loading