473,387 Members | 1,624 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,387 software developers and data experts.

DB2DataAapter.Update() Method error

2
Hi,

I started programming with DB2 recently. I have a C# .NET application that selects data from DB2 database into a DataSet object, changes the data in the DataSet object, copies the changed data to another DataSet object and updates the database with the changed data.

I am getting this error when I use the DB2DataAapter.Update() method

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any modifiable columns.

Here is the code I am using:
DB2DataAdapter db2adapter = new DB2DataAdapter();
DataSet db2dataset = new DataSet();
DataSet changesDataSet = new DataSet();
DB2Command db2command = new DB2Command(cmdtext, conn);

db2adapter.SelectCommand = db2command;
db2command.CommandTimeout = 5000;
DB2CommandBuilder CommBuild = new DB2CommandBuilder(db2adapter);

db2adapter.Fill(db2dataset);

/* code to change the data in the db2dataset goes here */

if (db2dataset.HasChanges(DataRowState.Modified))
{
changesDataSet = db2dataset.GetChanges(DataRowState.Modified);
}

db2adapter.Update(changesDataSet);

How do I resolve the error?

Thank you,
PK
May 9 '07 #1
1 1922
kpap
2
Hi, This is urgent. Could someone please take a look?
Thx,
PK

Hi,

I started programming with DB2 recently. I have a C# .NET application that selects data from DB2 database into a DataSet object, changes the data in the DataSet object, copies the changed data to another DataSet object and updates the database with the changed data.

I am getting this error when I use the DB2DataAapter.Update() method

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any modifiable columns.

Here is the code I am using:
DB2DataAdapter db2adapter = new DB2DataAdapter();
DataSet db2dataset = new DataSet();
DataSet changesDataSet = new DataSet();
DB2Command db2command = new DB2Command(cmdtext, conn);

db2adapter.SelectCommand = db2command;
db2command.CommandTimeout = 5000;
DB2CommandBuilder CommBuild = new DB2CommandBuilder(db2adapter);

db2adapter.Fill(db2dataset);

/* code to change the data in the db2dataset goes here */

if (db2dataset.HasChanges(DataRowState.Modified))
{
changesDataSet = db2dataset.GetChanges(DataRowState.Modified);
}

db2adapter.Update(changesDataSet);

How do I resolve the error?

Thank you,
PK
May 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
2
by: Joseph Markovich | last post by:
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which...
7
by: sea# | last post by:
I'm writing an app to keep results of survey in DB. Using MS Access. This method is writing answers to DB. Each survey has one question. Each time an answer arrive to method, I check to which...
1
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened ...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
1
by: Scott F K Hooper | last post by:
My ASP.NET 2.0 project has a GridView that I want to be able to edit and update records with. The GridView has been bound to an ObjectDataSource control that has the following Update method...
19
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...

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.