G
Guest
Hi,
I am trying to implement sql transactions. But I am not knowing how to
do that. I created a data access layer which contains methods to
select/insert/update tables in a database. I have also created a business
logic layer to retrieve/update the data from the data access layer. All of
this is working fine if there are no transactions involved. If I need to use
transactions, I am not knowing how to do that. Lets say I have a webform from
which I want to insert 10 records into our database. I need to make sure that
either all of them gets inserted or nothing gets inserted. so to do that I
need to have sql transactions. So how should I wrap these insert statements
inside transactions? Do I need to first get the sql connection object and
create a transaction in the webform and attach that transaction to the sql
connection object. And once all the transactions are done I would commit the
transactions inside the web form. Is it right to get the sql connection from
data access layer to the webform and implement the transactions? please let
me know.
Thanks,
sridhar.
I am trying to implement sql transactions. But I am not knowing how to
do that. I created a data access layer which contains methods to
select/insert/update tables in a database. I have also created a business
logic layer to retrieve/update the data from the data access layer. All of
this is working fine if there are no transactions involved. If I need to use
transactions, I am not knowing how to do that. Lets say I have a webform from
which I want to insert 10 records into our database. I need to make sure that
either all of them gets inserted or nothing gets inserted. so to do that I
need to have sql transactions. So how should I wrap these insert statements
inside transactions? Do I need to first get the sql connection object and
create a transaction in the webform and attach that transaction to the sql
connection object. And once all the transactions are done I would commit the
transactions inside the web form. Is it right to get the sql connection from
data access layer to the webform and implement the transactions? please let
me know.
Thanks,
sridhar.