예제 #1
0
 protected override void SetRowUpdatingHandler(DbDataAdapter adapter)
 {
     if (!(adapter is SqlDataAdapter))
     {
         throw new InvalidOperationException("Adapter needs to be a SqlDataAdapter");
     }
     rowUpdatingHandler = new SqlRowUpdatingEventHandler(RowUpdatingHandler);
     ((SqlDataAdapter)adapter).RowUpdating += rowUpdatingHandler;
 }
예제 #2
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// sqlrowupdatingeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this SqlRowUpdatingEventHandler sqlrowupdatingeventhandler, Object sender, SqlRowUpdatingEventArgs e, AsyncCallback callback)
        {
            if (sqlrowupdatingeventhandler == null)
            {
                throw new ArgumentNullException("sqlrowupdatingeventhandler");
            }

            return(sqlrowupdatingeventhandler.BeginInvoke(sender, e, callback, null));
        }
예제 #3
0
        /// <include file='doc\SqlDataAdapter.uex' path='docs/doc[@for="SqlDataAdapter.OnRowUpdating1"]/*' />
        override protected void OnRowUpdating(RowUpdatingEventArgs value)
        {
            SqlRowUpdatingEventHandler handler = (SqlRowUpdatingEventHandler)Events[ADP.EventRowUpdating];

            if ((null != handler) && (value is SqlRowUpdatingEventArgs))
            {
                handler(this, (SqlRowUpdatingEventArgs)value);
            }
        }
        protected override void OnRowUpdating(RowUpdatingEventArgs value)
        {
            SqlRowUpdatingEventHandler handler = (SqlRowUpdatingEventHandler)base.Events[EventRowUpdating];

            if ((handler != null) && (value is SqlRowUpdatingEventArgs))
            {
                handler(this, (SqlRowUpdatingEventArgs)value);
            }
            base.OnRowUpdating(value);
        }
예제 #5
0
 private void ClearHandlers()
 {
     if (null != this.adohandler)
     {
         ((OleDbDataAdapter)this.adapter).RowUpdating -= this.adohandler;
         this.adohandler = null;
     }
     else if (null != this.sqlhandler)
     {
         ((SqlDataAdapter)this.adapter).RowUpdating -= this.sqlhandler;
         this.sqlhandler = null;
     }
     else if (null != this.odbchandler)
     {
         ((OdbcDataAdapter)this.adapter).RowUpdating -= this.odbchandler;
         this.odbchandler = null;
     }
 }