473,770 Members | 1,823 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 4468
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
2059
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
2606
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
1431
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
7619
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
8775
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
1284
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
7326
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
3178
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
9849
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
9453
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
10099
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
10036
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
9904
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
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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.