Solved

10774: transaction: database or .net framework?

Posted on 2014-11-28
4
153 Views
Last Modified: 2014-12-01
Hello experts:

1. When should I use transactions in the database? (begin, commit, rollback)
2. When I use the .net framework?

Which is better?
0
Comment
Question by:enrique_aeo
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40471623
When should you use transactions? When you have a piece of code that you might want to undo.

For example, I might
BEGIN TRAN
UPDATE a table
SELECT the updated table
ROLLBACK TRAN
Because I didn't actually want to commit the changes, just see what would happen.

Or I want to
debit someone's bank account, then
Credit someone else's.
If the credit didn't work, undo the debit.
0
 

Author Comment

by:enrique_aeo
ID: 40471624
OK

but, When I use the from  .net framework?
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40471631
I would suggest asking that as a separate question.
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40473491
It's simply a question of granularity.

Can a (distributed) database transaction do what you want? Or are external resources involved, which require special handling?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now