Answered by:
How to use SqlTransaction with multiple TableAdapters?

Question
-
I have thre Table adapters for three different tables. One table is master table and two other tables are details table. this is what im doing
1>MasterTableAdpter.Update(..)
get the newly created primary key assign it to two detail tables
2>DetailTableAdter1.Update(..)
2>DetailTableAdter2.Update(..)How do i put evrything into one transaction?
(NOTE: i may not be able to use TransactionScope becuase then i have to enable DTC service which i can not do on clients machine)
Tuesday, December 7, 2010 10:42 PM
Answers
-
You don't need to abandon TransactionScope. Check http://social.msdn.microsoft.com/Forums/en/windowstransactionsprogramming/thread/24eed3a6-7c5f-4ab0-b5c3-780b8cdea7cc for an example.
If you are using VS2008 or higher, I suggest you to tryTableAdapterManager and see the performance.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- Marked as answer by liurong luo Friday, December 17, 2010 8:40 AM
Tuesday, December 7, 2010 11:19 PM
All replies
-
You don't need to abandon TransactionScope. Check http://social.msdn.microsoft.com/Forums/en/windowstransactionsprogramming/thread/24eed3a6-7c5f-4ab0-b5c3-780b8cdea7cc for an example.
If you are using VS2008 or higher, I suggest you to tryTableAdapterManager and see the performance.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- Marked as answer by liurong luo Friday, December 17, 2010 8:40 AM
Tuesday, December 7, 2010 11:19 PM -
Im using SQL Server Express. and also one more thing the TableAdapter created by DataSet has the Transaction property. So all the above TableAdapters i mentioned they have the Transation property but not sure how to use it.Wednesday, December 8, 2010 2:33 AM
-
So all the above TableAdapters i mentioned they have the Transation property but not sure how to use it.
Hello,Would the following sample helps?
http://weblogs.asp.net/ryanw/archive/2006/03/30/441529.aspx
http://www.codeproject.com/KB/database/TableAdapter-Transaction.aspx
Roahn Luo [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Friday, December 17, 2010 8:40 AM