Re: Error Question
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Apr 2007 00:17:35 -0400
Reflection will work. If you need to check specifically for
SqlException, it might be easier to do this:
// Assume the exception is in a variable named "exception".
SqlException sqlEx = exception as SqlException;
// If the variable is not null, then use it.
if (sqlEx != null)
{
// Work with sqlEx here.
}
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"pvdg42" <pvdg42@xxxxxxxxxxxxxxxxx> wrote in message
news:upI4S6wfHHA.596@xxxxxxxxxxxxxxxxxxxxxxx
"MikeJ" <vettes_n_jets@xxxxxxxxx> wrote in message
news:I3eUh.10549$Kd3.2140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Im Building a error handler application
i dont know how to check the type of exception in my
messageformat() Method
also id like to know if a method is in the exception
Errors Collection in SqlException
how can i check the type of exception and if the
exception object has a Method
Tia
MJ
The System.Exception class should provide what you need.
http://msdn2.microsoft.com/en-us/library/system.exception_members.aspx
The getType() method and message property are good starting places.
Exception is the superclass for numerous exception types:
http://msdn2.microsoft.com/en-us/library/x4xzbdb9.aspx
If you catch Exception, you'll get a polymorphic reference to the actual
subtype.
.
- Follow-Ups:
- Re: Error Question
- From: MikeJ
- Re: Error Question
- References:
- Error Question
- From: MikeJ
- Re: Error Question
- From: pvdg42
- Error Question
- Prev by Date: Re: Bitmap Transformations
- Next by Date: Problem in creating a relationship in sql server 2005: Newbie
- Previous by thread: Re: Error Question
- Next by thread: Re: Error Question
- Index(es):
Relevant Pages
|