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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Transaction Safe Stored Proceedures

Status
Not open for further replies.

Stedo

Programmer
Sep 15, 2005
44
SE
hi,

I am currently working in C# with set of stored procedures in an MS SQL database. When I do an update in the MS SQL database there is no problem as I create an SqlTransaction and call the commit method to run the command. This works find until I need to call a stored procedure which uses both Updates and Selects, i.e. I want to have a transaction safe command but I also want to store the results of the command in a SqlDataReader after the transaction has been completed! Is there any way to do this?

Thanks in advance
Steve
 
How about coding the transaction into the stored procedure instead? If your logic rolls it back, then your stored procedure can return a code letting you know this.
 
hi,

Yup, I'm looking at that option however it would be nicer if I could rollback in the same way I do when I perform updates.

Thanks
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top