Transactions in ADO.Net or in the Database?

G

Guest

Is it best practice to handle transactions in ADO.Net or in the database
level within stored procedures?
 
B

Bruce Barker

it will depend. if using sqlserver, transactions hold locks and may cause
contention issues, so you want them open fo as short a time as possible. if
you can do the transaction with a single sp call, then you have reduced the
time down to the minimum.

if you did

tran = conn.BeginTransaction()

// execute sql statement

tran.Commit()

then you have added network hops (real slow in server time), to the amount
of time the transaction locks are held.

-- bruce (sqlwork.com)
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top