Solved

10774: transaction: database or .net framework?

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

808 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