Exception when using OraCommandBuilder after fetching Command — oracle-tech

    Forum Stats

  • 3,715,830 Users
  • 2,242,890 Discussions


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Exception when using OraCommandBuilder after fetching Command

175289 Member Posts: 4
I've written a simple program the fetches data into a DataSet, updates the data and uses a CommandBuilder to write the changes back to the database. Works fine. If, before calling DataAdapter.Update, I use the GetUpdateCommand to get fetch the UpdateCommand (I did this for diagnostic purposes), the DataAdapter.Update now fails with a "ConcurrencyViolation: the UpdateCommand affected 0 rows". Why? I might want to change the UpdateCommand but retain the builder's Insert and Delete commands, but it doesn't look like I can fetch the UpdateCommand.

DataSet ds = new DataSet();
OraDataAdapter da = new OraDataAdapter("select * from emp", "myconnectstring");
da.Fill(ds, "emp");
// update ds here omitted

OraCommandBuilder bld = new OraCommandBuilder(da);

// if I uncomment the next line Update fails
// without it, Update works
//da.UpdateCommand = bld.GetUpdateComamnd();
da.Update(ds, "emp");

Bob Beauchemin
[email protected]


  • 3004
    3004 Member Posts: 204,171

    This is actually the same issue covered in:

    "Concurrency violation: the UpdateCommand affected 0 records".

    Please read the details provided in the above named discussion topic.


This discussion has been closed.