uri zaj

uri zaj

  • NA
  • 1
  • 0

changing data via OleDbRowUpdatedEventHandler

Aug 10 2007 7:14 AM
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();

}