27.12.2012 Views

Oracle® Rdb Data Provider for .NET - Downloads - Oracle

Oracle® Rdb Data Provider for .NET - Downloads - Oracle

Oracle® Rdb Data Provider for .NET - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

See the Microsoft .<strong>NET</strong> V2.0 documentation <strong>for</strong> more details on writing data provider independent<br />

code.<br />

5.7.2 Limited TransactionScope now available<br />

▲contents<br />

TransactionScope may now be used with <strong>Rdb</strong>Enlistments. However as ORDP does not currently<br />

support the use of distributed transactions, the support <strong>for</strong> TransactionScope is currently limited to<br />

transactions within single connections.<br />

// C#<br />

.<br />

.<br />

.<br />

<strong>Rdb</strong>Command cmd = new <strong>Rdb</strong>Command(<br />

"insert into customers values (888,1092,'GEORGE')", conn);<br />

try<br />

{<br />

using (TransactionScope scope = new TransactionScope())<br />

{<br />

//Create an enlistment object<br />

<strong>Rdb</strong>Enlistment myEnlistment = new <strong>Rdb</strong>Enlistment(conn);<br />

Guid myGuid = Guid.NewGuid();<br />

//Enlist on the current transaction with the enlistment object<br />

Transaction.Current.EnlistDurable(myGuid, myEnlistment,<br />

EnlistmentOptions.None);<br />

}<br />

cmd.ExecuteNonQuery();<br />

scope.Complete();<br />

}<br />

catch (System.Transactions.TransactionException ex)<br />

{<br />

Console.WriteLine(ex);<br />

}<br />

.<br />

.<br />

.<br />

See the Microsoft .<strong>NET</strong> V2.0 documentation <strong>for</strong> more details on TransactionScope.<br />

40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!