JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay,
I'm doing a lot of SQL statment direct manipulation of my database, creating SqlConnections, SqlCommands, Executing the commands, then disposing of both and doing it all over again. Occasionally an error occurs in the process (as we know is apt to happen) and I want to cancel all the changes made. Some of the changes are easy, because, well they are Temp Tables so I remove them automatically. But others I cannot just "Delete from X", because there is other data to preserve.
Given the nature of this, Can I like...enter the entire Process and Put a Marker, like BeginTransaction() or what not, and then on Any Kick out due to an Exception, do Transaction.Rollback() or if it was successful, do Transaction.Commit, or would i have to do it per operation, etc.
Thanks
I'm doing a lot of SQL statment direct manipulation of my database, creating SqlConnections, SqlCommands, Executing the commands, then disposing of both and doing it all over again. Occasionally an error occurs in the process (as we know is apt to happen) and I want to cancel all the changes made. Some of the changes are easy, because, well they are Temp Tables so I remove them automatically. But others I cannot just "Delete from X", because there is other data to preserve.
Given the nature of this, Can I like...enter the entire Process and Put a Marker, like BeginTransaction() or what not, and then on Any Kick out due to an Exception, do Transaction.Rollback() or if it was successful, do Transaction.Commit, or would i have to do it per operation, etc.
Thanks