S
SilentCry
this is driving me nuts.. i'm trying to do something that i thought would be
relatively simple but it's not turning out that way. all i want to do is
check for a specific HResult of 0x80004005 in my catch stmt..
catch (OleDbException ex)
{
if (ex.ErrorCode != 0x80004005) // duplicate record, OK - anything
else, not
throw;
}
first, ErrorCode is defined as a property returning an int but described as
returning the HResult of the operation. so which is it, int or HResult??
i tried casting the constant as an int but that didn't work. the error said
something about using the unchecked macro.
i tried casting the constant as an HRESULT but the compiler didn't recognize
that type.
i tried doing a Convert.ToInt16 and Convert.ToInt32 on the constant but got
overflow errors at run time.
what the heck is going on here? i must be missing something but i don't know
what. seems to me it should be a lot simpler than this.
relatively simple but it's not turning out that way. all i want to do is
check for a specific HResult of 0x80004005 in my catch stmt..
catch (OleDbException ex)
{
if (ex.ErrorCode != 0x80004005) // duplicate record, OK - anything
else, not
throw;
}
first, ErrorCode is defined as a property returning an int but described as
returning the HResult of the operation. so which is it, int or HResult??
i tried casting the constant as an int but that didn't work. the error said
something about using the unchecked macro.
i tried casting the constant as an HRESULT but the compiler didn't recognize
that type.
i tried doing a Convert.ToInt16 and Convert.ToInt32 on the constant but got
overflow errors at run time.
what the heck is going on here? i must be missing something but i don't know
what. seems to me it should be a lot simpler than this.