protected static void OnRowUpdating(object sender, OleDbRowUpdatingEventArgs args) { if (args.StatementType == StatementType.Insert) { System.IO.TextWriter writer = System.IO.File.AppendText("Inserts.log"); writer.WriteLine("{0}: Customer {1} Inserted.", DateTime.Now, args.Row["CustomerID"]); writer.Close(); } }
// ---------------------------------------------------------------- // ---------------------------------------------------------------- void OnRowUpdating(Object objSender, OleDbRowUpdatingEventArgs objArgs) { // event handler for the RowUpdating event // see if its an INSERT statement. If so we need to save the // temporary order ID allocated on the client while disconnected // so we can update the child rows with the "real" order ID // after the row has been inserted into the data store if (objArgs.StatementType == StatementType.Insert) { // save the temporary order ID in the class-level variable m_InsertOrderID = (int)objArgs.Row["OrderID", DataRowVersion.Current]; } }
//////////////////////////////////////////////////// private void OnRowUpdating(object sender, OleDbRowUpdatingEventArgs args) { if (args.StatementType == StatementType.Delete && (m_etatsAPrendreEnCompte & DataRowState.Deleted) == 0) { args.Status = UpdateStatus.SkipCurrentRow; } if (args.StatementType == StatementType.Insert && (m_etatsAPrendreEnCompte & DataRowState.Added) == 0) { args.Status = UpdateStatus.SkipCurrentRow; } if (args.StatementType == StatementType.Update && (m_etatsAPrendreEnCompte & DataRowState.Modified) == 0) { args.Status = UpdateStatus.SkipCurrentRow; } }
private void oleDBda_RowUpdating(object sender, OleDbRowUpdatingEventArgs e) { Exception exp = null; switch (e.StatementType) { case StatementType.Insert: try { BeginCase("RowInsert"); Compare(drInsert, e.Row); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } EventCounter++; break; case StatementType.Delete: try { BeginCase("RowDelete"); Compare(drDelete, e.Row); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } EventCounter++; break; case StatementType.Update: try { BeginCase("RowUpdate"); Compare(drUpdate, e.Row); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } EventCounter++; break; } }
/// <summary> /// Handles the RowUpdating event /// </summary> /// <param name="obj">The object that published the event</param> /// <param name="e">The OleDbRowUpdatingEventArgs</param> protected void RowUpdating(object obj, OleDbRowUpdatingEventArgs e) { base.RowUpdating(obj, e); }
private void OleDbRowUpdating(object sender, OleDbRowUpdatingEventArgs ruevent) { RowUpdating(sender, ruevent); }
private static void myDataAdapter_RowUpdating(object sender, OleDbRowUpdatingEventArgs e) { Console.WriteLine(e.Row.RowState); Console.WriteLine("rowUpdating " + e.Command.CommandText); }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// oledbrowupdatingeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this OleDbRowUpdatingEventHandler oledbrowupdatingeventhandler, Object sender, OleDbRowUpdatingEventArgs e, AsyncCallback callback) { if (oledbrowupdatingeventhandler == null) { throw new ArgumentNullException("oledbrowupdatingeventhandler"); } return(oledbrowupdatingeventhandler.BeginInvoke(sender, e, callback, null)); }