Re: How do I capture Delphi 5 TADODataset timeout error consistently?
- From: "casman53024" <casman53024@xxxxxxxxxxx>
- Date: 25 Aug 2005 13:38:34 -0700
I've noticed some other interesting behavior with the TADODataset in
Delphi 5. When I run a query that executes a stored procedure, the
commandtimeout usually gets used (whether it throws and exception or
not). If I just run straight SQL text that returns a large dataset,
such as "SELECT about10millionrecords from MyDB.dbo.MyTable", the app
just hangs, and never seems to continue past the code that activates
the query.
Thanks.
casman53024 wrote:
> 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.
.
- References:
- How do I capture Delphi 5 TADODataset timeout error consistently?
- From: casman53024
- How do I capture Delphi 5 TADODataset timeout error consistently?
- Prev by Date: Alter table and update with ADO
- Next by Date: Re: Alter table and update with ADO
- Previous by thread: How do I capture Delphi 5 TADODataset timeout error consistently?
- Next by thread: Problem with field name that uses #
- Index(es):
Relevant Pages
|