Example #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the SQL statement or stored procedure
        /// that is described by this <see cref="MySqlCommand"/>.
        /// </summary>
        /// <returns>An <see cref="IAsyncResult"/> that can be used to poll or wait for results,
        /// or both; this value is also needed when invoking <see cref="EndExecuteNonQuery"/>,
        /// which returns the number of affected rows. </returns>
        public IAsyncResult BeginExecuteNonQuery()
        {
            AsyncExecuteNonQueryDelegate del =
                new AsyncExecuteNonQueryDelegate(ExecuteNonQuery);

            asyncResult = del.BeginInvoke(null, null);
            return(asyncResult);
        }
Example #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the SQL statement or stored procedure
        /// that is described by this <see cref="MySqlCommand"/>.
        /// </summary>
        /// <param name="callback">
        /// An <see cref="AsyncCallback"/> delegate that is invoked when the command's
        /// execution has completed. Pass a null reference (<b>Nothing</b> in Visual Basic)
        /// to indicate that no callback is required.</param>
        /// <param name="stateObject">A user-defined state object that is passed to the
        /// callback procedure. Retrieve this object from within the callback procedure
        /// using the <see cref="IAsyncResult.AsyncState"/> property.</param>
        /// <returns>An <see cref="IAsyncResult"/> that can be used to poll or wait for results,
        /// or both; this value is also needed when invoking <see cref="EndExecuteNonQuery"/>,
        /// which returns the number of affected rows. </returns>
        public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject)
        {
            AsyncExecuteNonQueryDelegate del =
                new AsyncExecuteNonQueryDelegate(ExecuteNonQuery);

            asyncResult = del.BeginInvoke(callback, stateObject);
            return(asyncResult);
        }