How do I capture Delphi 5 TADODataset timeout error consistently?
- From: "casman53024" <danielpitz@xxxxxxxxxxx>
- Date: 22 Aug 2005 11:34:20 -0700
I am using Delphi 5, hitting a SQL Server 2000 database.
I have a simple reporting application that uses a TADODataset to run
various SQL queries and put the results into a TListView. It uses a
registry entry to modify the commandtimeout property of the
TADODataset. I use the following code to attempt to capture the
timeout error if one occurs:
{lDSMain is a TADODataset object}
lDSMain.CommandText := SomeSQLText5;
lDSMain.CommandTimeout := GetADOTimeout; {gets value from
registry, else 300 }
try
lDSMain.Active := true;
except
on E: Exception do begin
MessageDlg(E.Message, mtInformation,[mbOk], 0);
Exit;
end;
end;
After lDSMain runs, it loops through its datasets, assigning each to
another TADODataset object, and displaying the contents of each.
The trouble is, it doesn't always cause an exception when it times out.
If the timeout does not get recognized, it continues into the section
that is trying to loop through the datasets, and then causes an E_FAIL
Status error.
Is there an explanation for this behavior, or a better way to capture
the SQL timeout?
Thanks.
.
- Follow-Ups:
- Re: How do I capture Delphi 5 TADODataset timeout error consistently?
- From: casman53024
- Re: How do I capture Delphi 5 TADODataset timeout error consistently?
- Prev by Date: Re: How to sort data on grid?
- Next by Date: Re: Populate dataset with text file
- Previous by thread: How to sort data on grid?
- Next by thread: Re: How do I capture Delphi 5 TADODataset timeout error consistently?
- Index(es):
Relevant Pages
|