473,287 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Transaction and TypedDataSEt

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

May 19 '06 #1
4 1769
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.)

May 22 '06 #2
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.)

May 24 '06 #3
On Wed, 24 May 2006 11:54:55 GMT, st*****@online.microsoft.com (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
May 24 '06 #4
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.)

May 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
10
by: TZoner | last post by:
1) Can one find the location of the 'Transaction Log' at: <Hard Disk>\Program Files\Microsoft SQL Server\MSSQL\Data\MyDb_Log.ldf? 2) Is it safe to delete it, as SQL will create a new Transaction...
3
by: Thiko | last post by:
Hi I take one nightly full database backup at 02:00 and backup the transaction log to one backup set every 15mins. The commands to do this are as follows and are set up to run as database...
2
by: Deepak Mehta | last post by:
i have to update two tables from ASP pages with same data but i want that both of them should be updated at one time. If either of them is not updated then my transaction should roll back.I want...
1
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? ...
2
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
15
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried)...
1
by: Matik | last post by:
Hi to all, Probably I'm just doing something stupid, but I would like you to tell me that (if it is so), and point the solution. There ist the thing: I' having a sp, where I call other sp...
1
by: orenl | last post by:
Hi, Im using the VisualStudio 2005 designer to create typedDataSet (drag & drop from the service explorer). All the DataTables in the generated code inherit from System.Data.DataTable, I would...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.