Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > implementing sql transactions in data access layers

Reply
Thread Tools

implementing sql transactions in data access layers

 
 
=?Utf-8?B?U3JpZGhhcg==?=
Guest
Posts: n/a
 
      10-10-2006
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.
 
Reply With Quote
 
 
 
 
Sean Chambers
Guest
Posts: n/a
 
      10-11-2006
Here is some documentation to get you started:
http://msdn.microsoft.com/library/de.../html/daag.asp

In the past, when I have needed transactions, I have not done them in
the data layer, but within a stored procedure, recently though I have
begun to toy with them within the data access layer, mainly with O/R
Mappers.

Transactions is a large topic, so reading the above link will give you
the low down.

hope it helps!

Sean

Sridhar wrote:
> 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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3JpZGhhcg==?=
Guest
Posts: n/a
 
      10-11-2006
Thank you.

"Sean Chambers" wrote:

> Here is some documentation to get you started:
> http://msdn.microsoft.com/library/de.../html/daag.asp
>
> In the past, when I have needed transactions, I have not done them in
> the data layer, but within a stored procedure, recently though I have
> begun to toy with them within the data access layer, mainly with O/R
> Mappers.
>
> Transactions is a large topic, so reading the above link will give you
> the low down.
>
> hope it helps!
>
> Sean
>
> Sridhar wrote:
> > 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.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CODING PRACTICE. Business and Data Access Layers Savvoulidis Iordanis ASP .Net 7 07-23-2008 11:06 PM
Question on two 'flavors' of data access layers kbutterly ASP .Net 3 01-30-2007 07:54 PM
Subnets between core and access/distribution layers & routing between layers J Cisco 0 12-13-2006 08:38 PM
Load Balance Business and Data Access Layers EAI ASP .Net 0 07-06-2006 04:33 AM
SQL Transactions and Database Pooling DiscoStu Java 3 09-24-2003 08:17 PM



Advertisments