How to explicit trap a Time Out exception?

How to explicit trap a Time Out exception?

Post by Mari » Wed, 02 Nov 2005 07:26:26

It seems to me that a "time out" exception is a fairly routine
exception that can occur either when I'm reading from or updating to a
database. That said, it's a bit curious that there is no built-in
exception for trapping a time out.

Presently, I simply trap a vanilla SqlException and then I check the
start of the message for the "Timeout expired." text. If I find it, I
recast the exception using a "new TimeoutException(ex)". I defined
this custom exception myself.

Doesn't it seem practical that the .NET framework would include a
native exception such as TimeoutException or SqlTimeoutException? Why
should I and thousands of other programmer have to parse the message

How are others handling time out exceptions? Am I missing something?

Mario T. Lanza
Clarity Information Architecture, Inc.

How to explicit trap a Time Out exception?

Post by Khaled Hus » Wed, 02 Nov 2005 20:22:01

Hello Mario,
May I ask if you are working with .NET 1.1 or 2.0?

if you are working with .NET 2.0: I have good news for you and the other
thousands of developers, Microsoft has embedded a new TimeoutException class
and here is its link

if you are using .NET 1.x I guess also that you might have missed something
regarding this exception, Check this link

I am not quite sure of the .NET 1.x exception class if it meets your needs
or not.

Khaled Hussein
Graduate Teaching Assistant
College of Computing and Information Technology
Arab Academy for Science and Technology and Maritime Transport
Web Site:
(The power of imagination makes us infinite.)