G
Guest
Hi,
I have seen difference approaches in handling transactions on the msdn site.
One approach is that you open a connection and then begin the transaction.
Next you execute command objects using this connection and after you are done
you commit or rollback thereby giving a global scope to the transaction for
all the command objects. Second approach is you open the connection, begin
the transaction and then keep a reference of this transaction and then when
you are executing a command object you assign the transaction object to the
command object. This would mean assigning that same transaction object for
every command object that you want to execute(optional as i might not want to
enlist my transaction for a particular command)
Now the question is are the two approaches similar or in other words is
assigning the transaction object to a command object optional as the
connection already started the transaction ? Which one is a better approach ?
Anybody from Microsoft if you can answer this question.
Thanks!
I have seen difference approaches in handling transactions on the msdn site.
One approach is that you open a connection and then begin the transaction.
Next you execute command objects using this connection and after you are done
you commit or rollback thereby giving a global scope to the transaction for
all the command objects. Second approach is you open the connection, begin
the transaction and then keep a reference of this transaction and then when
you are executing a command object you assign the transaction object to the
command object. This would mean assigning that same transaction object for
every command object that you want to execute(optional as i might not want to
enlist my transaction for a particular command)
Now the question is are the two approaches similar or in other words is
assigning the transaction object to a command object optional as the
connection already started the transaction ? Which one is a better approach ?
Anybody from Microsoft if you can answer this question.
Thanks!