Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Transaction and TypedDataSEt

Reply
Thread Tools

Transaction and TypedDataSEt

 
 
liming
Guest
Posts: n/a
 
      05-19-2006
Hi,

I know it's possible to have transactions with Typed DataSet, but I have yet
to find an example of it.

For example, I have two typed TableAdapter

CommerceDataSet.xsd

CustomerTableAdapater

Insert(@CustomerName)

OrdersTableAdapater

Insert(@CustomerID, @ProductID)

My sample code

CustomerTableAdapater customer = new CustomerTableAdapater();
OrdersTableAdapater orders = new OrdersTableAdapater();
String customername = blah;
int customerid = 0, productid=0;
.....
......
customer.insert(customername);
.....
orders.insert(customerid,productid);

....



How do I hook up transaction to both "Insert" method, if one fails, roll
back? I have projects to finish up quickly in a month, and I prefer to use
these typed datatable as my datalayer for now as it does mostly what I
needed instead of implementing a whole layer myself manually using
EnterpriseLibrary which really gets me the same result against sql server
2000. Once I have this transaction issue resolved, I'm good to go.

Another question, what's your opinion in terms of implement my data layer
using Typed DataSet instead of my own classes? I do it right now beause it's
quicker, mainly saves me a lot keystrokes considerably. What other benefit
do you see? Just curious.

Thanks



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-22-2006
Hello liming,

Welcome to the MSDN newsgroup.

From your description, I understand you're wondering the proper means to
perform transaction control when using multiple ADO.NET
tableadapter/typeddataset components in .NET application, correct?

As for ADO.NET, it used to provide connection specific transaction support,
that means the transaction's scope is limited to a single connection. Such
single connection specific transaction is started by calling the
"Connection.BeginTransaction" method and associating other command objects
with the returned transaction instance. According to your scenario, you
have multiple TableAdapters (each of them will have a connection object
associated with it), then I think you can consider use the new transaction
control feature provided in the .NET framework 2.0, it is under the
"System.Transaction" namespace.

You can just create a "TransactionScope" class instance and wrap other
connections/commands's creation code within this "TransactionScope"
instance's lifecycle, this will help implicitly establish a transaction
context. Here are some msdn articles mentioned this:

#Implementing an Implicit Transaction using Transaction Scope
http://msdn2.microsoft.com/en-us/ms172152.aspx

#System.Transactions Namespace
http://msdn2.microsoft.com/en-us/sys...nsactions.aspx

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-24-2006
Hi Liming,

How are you doing on this issue? Does the information in my last reply
helps you a little? BTW, if you have any data access specific questions,
you can also post in the microsoft.public.dotnet.framework.adonet
newsgroup. There are also many ADO.NET experienced guys there who can help
you.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
PeterKellner
Guest
Posts: n/a
 
      05-24-2006
On Wed, 24 May 2006 11:54:55 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed) (Steven
Cheng[MSFT]) wrote:

>Hi Liming,
>
>How are you doing on this issue? Does the information in my last reply
>helps you a little? BTW, if you have any data access specific questions,
>you can also post in the microsoft.public.dotnet.framework.adonet
>newsgroup. There are also many ADO.NET experienced guys there who can help
>you.
>
>Regards,
>
>Steven Cheng
>Microsoft Online Community Support


Steven,

Not sure how Liming is doing, but you post helped me a lot. I had the
some wonder and before this didn't know about transaction scope.
Thanks.
Peter Kellner
http://peterkellner.net
 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-25-2006
Thanks for your input Peter,

Glad to be of assistance!

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
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
problem trying to consume web service that returns a strongly typeddataset from 1.1 web app steven ASP .Net 0 08-21-2008 02:40 PM
transaction and access andrea ASP .Net 0 02-28-2006 03:02 PM
Win2003 SP1 error: "New transaction cannot enlist in the specified transaction coordinator" Vencz Istv?n ASP General 2 05-02-2005 05:53 AM
Determining the Better Approach of Transaction in n-tier Application Model and where Transactions are maintained msnews.microsoft.com ASP .Net 2 03-29-2005 05:16 PM
TypedDataSet doesnot pass correctly in Web service David ASP .Net Web Services 0 05-31-2004 09:16 AM



Advertisments