I would love to use DB transactions however the situation I am in is not
feasible necessarily.
I am updating one record in one table and then I have to do a loop through
an arraylist and perform an insert into another table. I have decided it will
be best to do a delete then insert instead of doing an update or add routine.
My problem is I don't want one change taking place if the other fails.
So basically I would like to execute many SQLCommands under one transaction
object. I believe I can do this with ADO.Net transactions on the page. I
normally use all stored procedures and perform my transactions from there but
now I needed to execute all the sp commands under a single transaction object.
Marty
"Eliyahu Goldin" wrote:
The answer to your question is yes, it is guaranteed.
May be you should consider using database transactions to ensure data
integrity.
Eliyahu
"Marty U." <Ma****@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com... In the following try catch block can I guarantee that part b will not
execute if part a throws exception
try {
part a
part b
}
catch (Exception ex) {
do something
}
finally {
dispose of any thing needed
}
I am doing a DB update in part a and an insert in part b based on part a
data. I need to make sure that part a is successful before doing part b.
Part b could be multiple items from a listbox that may or may not be
different then what's already in the table. I could delete all and then
insert these but I have to make sure that part a completed successfully.
Then if part b fails I need to rollback any of the changes.
Thanks