private void HandleCallbackHX(IAsyncResult myResult) { try { SqlCommand myCmd2 = (SqlCommand)myResult.AsyncState; SqlDataReader myReader2 = myCmd2.EndExecuteReader(myResult); myTable2 = new DataTable(); myTable2.Load(myReader2); // Stop the watch so we can see how long it took to process myCallBackWatchHX.Stop(); String myCallBackTime = myCallBackWatchHX.ElapsedMilliseconds.ToString(); displayTimeInfoDelegateHX myWatchdisplayHX = new displayTimeInfoDelegateHX(displayHXTime); this.Invoke(myWatchdisplayHX, myCallBackTime); displayDataHX myDataDelegate = new displayDataHX(DisplayDataResultsHX); this.Invoke(myDataDelegate, myTable2); } catch (Exception exep) { this.Invoke(new displayDataHX(DisplayDataResultsHX), String.Format("Ready(last error: {0}", exep.Message)); //MessageBox.Show(exep.Message); } finally { isExecutingHX = false; if (objConHX != null) { objConHX.Close(); } //myTable2.Clear(); //myTable2=null; } }
private void HandleCallbackCODD(IAsyncResult myResult) { try { SqlCommand myCmd1 = (SqlCommand)myResult.AsyncState; SqlDataReader myReader1 = myCmd1.EndExecuteReader(myResult); //myTable1.Clear(); myTable1 = new DataTable(); myTable1.Load(myReader1); // Stop the watch so we can see how long it took to process myCallBackWatchCODD.Stop(); String myCallBackTime = myCallBackWatchCODD.ElapsedMilliseconds.ToString(); displayTimeInfoDelegateHX myWatchdisplayCODD = new displayTimeInfoDelegateHX(displayCODDTime); this.Invoke(myWatchdisplayCODD, myCallBackTime); displayDataCODD myDataDelegate = new displayDataCODD(DisplayDataResultsCODD); this.Invoke(myDataDelegate, myTable1); } catch (Exception exep) { this.Invoke(new displayDataCODD(DisplayDataResultsCODD), String.Format("Ready(last error: {0}", exep.Message)); //MessageBox.Show(exep.Message); } finally { isExecutingCODD = false; if (objConCODD != null) { objConCODD.Close(); } //myTable1.Clear(); //myTable1=null; } }