Exemple #1
0
        public static void ContinueIar(IAsyncResult iar)
        {
            IarState state = (IarState)iar.AsyncState;

            try
            {
                state.Command.EndExecuteNonQuery(iar);
            }
            finally
            {
                state.Dispose();
            }
        }
Exemple #2
0
        public static void BeginRunIar()
        {
            IarState state = new IarState();

            try
            {
                state.Connection = new SqlConnection(connStr);
                state.Connection.Open();
                state.Command = new SqlCommand(sql, state.Connection);
                IAsyncResult iar = state.Command.BeginExecuteNonQuery(ContinueIar, state);
                if (iar.CompletedSynchronously)
                {
                    state.Command.EndExecuteNonQuery(iar);
                    state.Dispose();
                }
            }
            catch
            {
                state.Dispose();
            }
        }