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