Solved

10774: transaction: database or .net framework?

Posted on 2014-11-28
4
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 34

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

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…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

751 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