0
Answer

changing data via OleDbRowUpdatedEventHandler

uri zaj

uri zaj

17y
2.2k
1
I am trying to change some of the data after calling dataadapter.update() and before insert to database by  catching it in a OleDbRowUpdatedEventHandler. I can red the data and change it in the event handler but it dose not change the fileds whene updateing the database!!!

:-(

my code is:

 

static void da_OnRowUpdate(object sender, OleDbRowUpdatedEventArgs e)

{

   e.Row[1] = "test 1";

   e.Row.AcceptChanges();

}

private void updateDB2()

{

      OleDbConnection cnn = new OleDbConnection(conStr);

      OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM parts", cnn);

      da.RowUpdated += new OleDbRowUpdatedEventHandler(da_OnRowUpdate);

      OleDbCommandBuilder MyCmd = new OleDbCommandBuilder(da);

      da.Update(dsParts , "parts");

      cnn.Close();

}