473,686 Members | 2,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is difference between SqlTransaction and T-Sql(begin tran, commit tran, rollback tran)

what is difference between SqlTransaction and T-Sql(begin tran, commit
tran, rollback tran)

thanks.

Nov 17 '05 #1
3 4462
SqlTransaction is a class that calls TSql for you.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Junyin.Wu" <ta**********@g mail.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
what is difference between SqlTransaction and T-Sql(begin tran, commit
tran, rollback tran)

thanks.

Nov 17 '05 #2
you mean:
-----
SqlConnection.B eginTransaction ();
SqlTransaction. Commit();
SqlTransaction. Rollback();
----
are equal to
---
SqlCommand.Comm andText = "Begin Tran" // "Commit Tran" // "Rollback
Tran";
SqlCommand.Exec uteNonQurey();
----
?

Thanks.

Nov 18 '05 #3
Yup.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Junyin.Wu" <ta**********@g mail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
you mean:
-----
SqlConnection.B eginTransaction ();
SqlTransaction. Commit();
SqlTransaction. Rollback();
----
are equal to
---
SqlCommand.Comm andText = "Begin Tran" // "Commit Tran" // "Rollback
Tran";
SqlCommand.Exec uteNonQurey();
----
?

Thanks.

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1384
by: Kristoff Six | last post by:
Hello, I was reading the MySQLmanual and became confused about myISAM and commit/rollback. Can someone explain what I have to do in my queries to garuanty the dataintegrity of my db in case I use myISAM? Do I have to use the commit and rollback statements or is this done by MySQL self? Thanks in advance!
2
2054
by: mahajan.sanjeev | last post by:
I have two SQLConnection objects having the same connection string and two corresponding SQLCommand objects for each connection object. I am using SQLTransaction with the first SQLConnection object but the second SQLConnection object does not have any SQLTransaction object. I am inserting some data using the two command objects. The problem happens when I try to do a rollback on the SQLTransaction object. The rollback happens only before...
2
2602
by: gabriel | last post by:
Greetings, I am adding foreign keys to a database and saving the generated scripts. What I do not understand is that all script begin with empty transactions. Why ? Example follows : /*
5
1426
by: Piotr Strycharz | last post by:
Hi, The question is about how to check if the transaction is still active. Let's say, that I am using a 3rd party stored procedure, that cannot be changed. Sample is (Of course, the real one is much more complicated): CREATE PROC test AS IF @@trancount > 0 ROLBACK TRAN Now, I'm executing code: tran = connection.BeginTransaction();
9
7604
by: John Sidney-Woollett | last post by:
Is it possible to use the dblink and dblink_exec features from inside pl/pgsql functions to mimic the behaviour of nested transactions by calling another function or executing some SQL via the dblink (into the same database)? Does the SQL statement executed within the dblink sit in its own isolated transaction/session? And would an error thrown in the dblink statement abort the enclosing session that initiated the call? What is the...
7
8762
by: fyi85 | last post by:
I have 8.1.5 on Windows 2003, when I do from CLP with auto commit off: db2 update table set column=something and then db2 terminate and then db2 connect to db db2 select updated column from table the update is committed anyways, whereas the docs state that the update is supposed to be rolled back (auto commit is off) Does this indicate a bug or a mistake in the docs?
0
1279
by: eric.goforth | last post by:
Hello, I have a subroutine similar to the following: Private Sub RunUpdateTransaction(ByVal UpdateSQL As String, ByVal UpdateConn As SqlConnection) Dim trnDedupe As SqlTransaction = UpdateConn.BeginTransaction(IsolationLevel.ReadCommitted, "Dedupe")
3
7321
by: sajithamol | last post by:
What is the need of BEGIN TRAN...COMMIT TRAN? Also why you are setting Transaction isolation level to SERIALIZABLE?
15
3170
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, This is being called in a C# loop within an ado.net transaction from C# 1.1 code. It is used to write large file data to a SQL Server database in chunks, rather than in one go. I had the stored procedure below, which worked until the image datatype was changed to varbinary(max). Now I get the following error:
5
9846
by: keirnus | last post by:
Hello, I am using Datasheet view when displaying my data. The data are displayed in a "x,y" matrix wherein data can be directly edited in the Datasheet. Anything inputted in a certain cell is directly updated to DB. I want to open the Form, input data but WILL NOT COMMIT then close the Form. If I open the same Form again, the data shouldn't be changed because it wasn't committed.
0
8580
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8513
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9049
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8931
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8765
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8777
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4526
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2943
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.