J
jp2msft
I've got a thread that pulls data from the SQL Server.
After running a query, if the DataTable has records, I go on to process them.
If the DataTable does not have records, I want to exit the thread.
How do I exit the thread? I have tried:
/*****************************/
if (table.Rows.Count == 0) {
e.Cancel = true; // DoWorkEvenArgs e
e.Result = "No Records were found";
return;
}
// continue with record processing part of thread
/*****************************/
However, I get an exception thrown that my app can not handle, and it throws
it all the way up to Program.cs:
try {
Application.Run(new MdiForm());
} catch (Exception e) {
MessageBox.Show(e.Message);
}
e.Message = "Exception has been thrown by the target of an invocation."
That doesn't help me much, but maybe someone here can use it.
After running a query, if the DataTable has records, I go on to process them.
If the DataTable does not have records, I want to exit the thread.
How do I exit the thread? I have tried:
/*****************************/
if (table.Rows.Count == 0) {
e.Cancel = true; // DoWorkEvenArgs e
e.Result = "No Records were found";
return;
}
// continue with record processing part of thread
/*****************************/
However, I get an exception thrown that my app can not handle, and it throws
it all the way up to Program.cs:
try {
Application.Run(new MdiForm());
} catch (Exception e) {
MessageBox.Show(e.Message);
}
e.Message = "Exception has been thrown by the target of an invocation."
That doesn't help me much, but maybe someone here can use it.