Solved

10774: transaction: database or .net framework?

Posted on 2014-11-28
4
148 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 32

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

706 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

18 Experts available now in Live!

Get 1:1 Help Now