DB2DataAapter.Update() Method error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kpap
    New Member
    • May 2007
    • 2

    #1

    DB2DataAapter.Update() Method error

    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.U pdate() 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(cmdt ext, conn);

    db2adapter.Sele ctCommand = db2command;
    db2command.Comm andTimeout = 5000;
    DB2CommandBuild er CommBuild = new DB2CommandBuild er(db2adapter);

    db2adapter.Fill (db2dataset);

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

    if (db2dataset.Has Changes(DataRow State.Modified) )
    {
    changesDataSet = db2dataset.GetC hanges(DataRowS tate.Modified);
    }

    db2adapter.Upda te(changesDataS et);

    How do I resolve the error?

    Thank you,
    PK
  • kpap
    New Member
    • May 2007
    • 2

    #2
    Hi, This is urgent. Could someone please take a look?
    Thx,
    PK

    Originally posted by kpap
    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.U pdate() 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(cmdt ext, conn);

    db2adapter.Sele ctCommand = db2command;
    db2command.Comm andTimeout = 5000;
    DB2CommandBuild er CommBuild = new DB2CommandBuild er(db2adapter);

    db2adapter.Fill (db2dataset);

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

    if (db2dataset.Has Changes(DataRow State.Modified) )
    {
    changesDataSet = db2dataset.GetC hanges(DataRowS tate.Modified);
    }

    db2adapter.Upda te(changesDataS et);

    How do I resolve the error?

    Thank you,
    PK

    Comment

    Working...