Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQLServer transactions? 1

Status
Not open for further replies.

DeltaTech

Programmer
Apr 16, 2003
92
0
0
MY
Hi

Can anyone help with SQL server transactions please?

I have a number of updates to perform and want to commit the transactions only if all are successful.

With ADO, all that was needed were ADO BeginTrans, CommitTrans and RollbackTrans Methods. Have searched the web, but nothing really elaborate turned up.

A little help with how to construct the code would be very much appreciated.

Thanks

 
Sorry, forgot to mention that I am doing this in ASP.Net.

Thanks
 
Just write it as a stored procedure and use BEGIN TRANSACTION END TRANSACTION syntax. See BOL for details.
 
Hi markros

Thank you for your prompt reply.

Quote: "See BOL for details"

Sorry, could you clarify/elaborate please?

Thanks
 
Hi,

This is more of an ASP.Net question. However, if you've established a connection using SqlConnection(), you can create an instance of a SqlTransaction(). This class has the methods BeginTransaction(), Rollback() and Commit().

For typical usage there are plenty of resources online.

Ryan
 
Hi Ryan

Appreciate the feedback.

Yes it is an ASP.Net/VB.Net question, and you are right, I establishing a SqlConnection.

I have searched online, but could not find anything that explained the SqlTransaction process in simple enough terms. (Sorry mate, I am a beginner and sometimes find it a bit hard to filter through the techno babble.)

You said there are plenty of resources online. Could you point me to a few or perhaps help me with some sample code?
 
Hi Ryan

The example you gave is what I was looking for.

Thanks very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top