Solved

10774: transaction: database or .net framework?

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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.
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…

770 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