473,548 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlCommandBuild er + transaction

DG
I use this code:

_adapter = new SqlDataAdapter( selectString, _conn);
_adapter.Select Command = new SqlCommand(sele ctString, _conn);
_adapter.Select Command.Transac tion = _trans;
_builder = new SqlCommandBuild er(_adapter);
_adapter.Update (dt);

i get exception:
Execute requires the command to have a transaction object when the
connection assigned to the command is in a pending local transaction. The
Transaction property of the command has not been initialized.

Now, it worked on other DB! (!?).

Also:
after:
_builder = new SqlCommandBuild er(_adapter);
_adapter.Update Command , InsertCommand & DeleteCommands are null !!??, so i
can't check if Transaction property is set or not. (same thing on other DB
but update works there)
SqlCommand builder uses Transaction from SelectCommand, so there sould not
be problem.

It works OK without transaction.

Any ideas?
Thanx.
Feb 6 '06 #1
0 2603

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

Similar topics

1
1329
by: Nick | last post by:
Hi, The SqlCommandBuilder class seems to be able to remember the primary key of a row such that even if I change that key's value, it is still able to update only that row. So I would like to know how can I update a row even when the primary key is changed by the user? From the row's columns' information the original information seems to...
1
439
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? I have read the doc regarding this: http://www.developer.com/net/asp/article.php/3385631 but it will not work when methods are in different...
10
9320
by: Hank1234 | last post by:
Can I use one Data Adapter and one Command Builder to update amny tables? Currently in my data adapter I query two tables and fill them into two tables in a data set. When I make a change to a record in the second table and call the update method of the data adapter the command builders update command text is for the first table. Can the...
2
3883
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 is used - is it accurate way? 2. I have the following code blocks - In code block 1, the first check the DistributedIdentifier is ALL 0s so it
5
2829
by: microsoft.private.windows.netserver.setup | last post by:
I have a very strange thing occurring in the program. I have a dataset retrieved from a stored procedure that just select * from a table. I then try to use the SQlCommandBuilder on the dataset, and fails. I try the same select statement directly and not using a stored procedure and use SQLCommandBuilder, the program works. This is a ASP.net...
4
2126
by: Jim Reynolds | last post by:
Hi, I am using a SqlCommandBuilder to update a Db table via an updated DataSet and SqlAdapter and it doesn't seem to be generating the activity commands from the Select command. Here is a snippet. sda = new SqlDataAdapter(); sda.SelectCommand = new SqlCommand(sql,dbcon); SqlCommandBuilder scb = new SqlCommandBuilder(sda); DataSet ds =...
0
1139
by: Tony Johansson | last post by:
Hello! This small program below works but I have some questions about it. Below I have a piece of code that update a specific row in the northwind database. The class SqlCommandBuilder is used for creating a suitable update,insert or delete sql command that match thisAdapter.
1
1843
by: Tony Johansson | last post by:
Hello! When I use this SqlCommandBuilder will there be created sql command for all three sql statement(update,insert and delete) //Tony
2
3319
by: raulbolanos | last post by:
Hi Pr0's, I have a problem trying to implement the same example from this link: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx But instead of Sql I use MySql. When I fill the DataSet with the data from the DB I dont have any trouble I can even fill also a DataGridViewer and display the data in my...
0
7512
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
7438
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
7951
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...
0
6036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
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
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
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.