473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transaction for TableAdapters

DG
I have two SqlTableAdapter s (for typed dataset, generated by VS) and want to
do update of tables.
In transaction of course.

How to do it?

i try:

SqlConnection conn = new SqlConnection(G lobal.Connectio nString);

DSTableAdapters .Table1Adapter ta1 = new DSTableAdapters .Table1Adapter ();
DSTableAdapters .Table2Adapter ta2 = new DSTableAdapters .Table2Adapter ();

conn.Open();
trans = conn.BeginTrans action();

ta1.Connection = conn;
ta1.Connection = conn;

ta1.Update(DS.T able1);

I get an exception:

ExecuteReader requires the command to have a transaction when the connection
assigned to the command is in a pending local transaction. The Transaction
property of the command has not been initialized.

Thank you!
May 22 '06 #1
0 1570

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

Similar topics

3
4255
by: Christopher Kimbell | last post by:
I have a class library that contains a number of TableAdapters and I'm using this from a web application. Is there a way of getting the TableAdapters to use the connectionstrings defined in web.config. From the MSDN documentation it seems like it's possible to override settings with values in a config file for winform applications. Is the...
0
949
by: spooke | last post by:
HI all now are two days, 20 hours of work that i'm on this problem without a solution!!! I think i'll become mad!!! Here is the problem: I Use C# 2.0 (VS .Net 2005) with thyped dataset I Make my connection and the connection generates the DataTables and the TableAdapters
7
1383
by: CMM | last post by:
Unless someone has come up with a way, I still don't understand how you can use TableAdapters in a true n-tier infrastructure.... where the DataAccessLayer is in one Dll and *only* the Datasets themselves can be shared across layers. I find it inconceivable that this suggestion...
4
1781
by: liming | last post by:
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
0
984
by: rswafford | last post by:
Hi, I am beginning to rewrite an application in ASP.NET 2.0, and I want to utilize strongly typed TableAdapters for my data access layer. However the database that gets queried is not known until the user is logged in -- each client using this application has their own database on my company's server. I know that the SqlConnection object in...
4
2514
by: Ted Ngo | last post by:
I create a northwind Strongly Typed TableAdapters dataset, the create a query like "select a, b, c, d from employeetable" then bind it into the gridview dim t as new northwindTableAdapters gridview1.datasource = t.getdata() gridview1.databind() Now I create new query in the TableAdapters dataset
1
1845
by: Brett Romero | last post by:
I store my server and database names in a static class that all libraries use. Using a config file, I can switch from test, staging, or production servers easily. I like what TableAdapters are generated by VS.NET 2005 do. It seems most everything is there for you. However, because the TableAdapter controls everything, I'll have to go to...
0
872
by: Steve B. | last post by:
Hi, I've a businness layer with some business objects. In these objects, I use several TableAdapters to get and update data. In order to maintain the consistency of data, I'd like to use transaction. How can I combine both and the using(TransactionScope) statement ? By now I've something like this :
7
2489
by: =?Utf-8?B?R3JlZw==?= | last post by:
When using the VS Wizards to create a DataSet I select tables. Then, I use the TableAdapter Configuration Wizard to modify the underlying queries that retreive the data. What I'm wonder is, does this TableAdapter work in the same manner as a SQL Server Stored Procedure or View? Or, does it work like MS Access where it pulls all the data over...
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.