Пример #1
0
        private static DataSet RunThread2(string ConnectionString, string CommandText, CommandType commType, SqlParameterCollection Parameters)
        {
            // Create the delegate.
            AsynchDataSet caller = new AsynchDataSet(GetDataSet);

            // Initiate the asychronous call.
            IAsyncResult result = caller.BeginInvoke(ConnectionString, CommandText, commType, Parameters, GetGlobalInputs(), null, null);

            // Wait for the WaitHandle to become signaled.
            result.AsyncWaitHandle.WaitOne();

            // Call EndInvoke to retrieve the results.
            DataSet dResult = caller.EndInvoke(result);

            // Close the wait handle.
            result.AsyncWaitHandle.Close();
            caller = null;
            result = null;

            return(dResult);
        }
Пример #2
0
        private static DataSet RunThread2(string ConnectionString, string CommandText, CommandType commType, SqlParameterCollection Parameters)
        {
            // Create the delegate.
            AsynchDataSet caller = new AsynchDataSet(GetDataSet);

            // Initiate the asychronous call.
            IAsyncResult result = caller.BeginInvoke(ConnectionString, CommandText, commType, Parameters, GetGlobalInputs(), null, null);

            // Wait for the WaitHandle to become signaled.
            result.AsyncWaitHandle.WaitOne();

            // Call EndInvoke to retrieve the results.
            DataSet dResult = caller.EndInvoke(result);

            // Close the wait handle.
            result.AsyncWaitHandle.Close();
            caller = null;
            result = null;

            return dResult;
        }