i am trying to implement a timeout on my database querys...so if an operation runs for too long i need to cancel the query and return a timeout message to an asp.net page....
heres the code i was using for the timeout portion....problem is i am sometimes getting partial result sets from the query...
RunSearch search = new RunSearch(GetSearchResults);
Thread searchThread = new Thread(delegate() {
dsRes = search.Invoke(ProcessingID,
objSqlConnection,SearchStartTime); });
searchThread.Start();
// searchThread.Join(ResultPollingPeriod * 1000);
if (!searchThread.Join(ResultPollingPeriod * 1000))
{
searchThread.Abort();
dsRes = null;
return ReturnTimeoutMessage();
}
else
{
return dsRes;
}
any help is much appreciated...