BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I capture Delphi 5 TADODataset timeout error consiste

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
casman53024
Guest





PostPosted: Mon Aug 22, 2005 6:34 pm    Post subject: How do I capture Delphi 5 TADODataset timeout error consiste Reply with quote



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.

Back to top
casman53024
Guest





PostPosted: Thu Aug 25, 2005 8:38 pm    Post subject: Re: How do I capture Delphi 5 TADODataset timeout error cons Reply with quote



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:
Quote:
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.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.