D
DraguVaso
Hi,
I want my application do different actions depending on the exception it
gets.
For exemple: I have an SQL-table with a unique index. In case I try to
Insert a record that's alreaddy in it I get this exception: "Cannot insert
duplicate key row in object 'tblTelephones' with unique index
'UniqueValues'."
What I'm looking for is a way to identify the exception: in case I get this
exception I want to do this, in case of another I want to do that.
The most simple solution to me seems this:
Catch ex As Exception
If Left(ex.Message, 41) <> "Cannot insert duplicate key row in
object" Then
'do this action
End If
QAlthough, I'm not convinced this is the best way. Is there a way to
identify the exception with a unique number? Or I've seen once something
like a name for an error. Can anybody help me with this?
Thanks a lot in advance
Pieter
I want my application do different actions depending on the exception it
gets.
For exemple: I have an SQL-table with a unique index. In case I try to
Insert a record that's alreaddy in it I get this exception: "Cannot insert
duplicate key row in object 'tblTelephones' with unique index
'UniqueValues'."
What I'm looking for is a way to identify the exception: in case I get this
exception I want to do this, in case of another I want to do that.
The most simple solution to me seems this:
Catch ex As Exception
If Left(ex.Message, 41) <> "Cannot insert duplicate key row in
object" Then
'do this action
End If
QAlthough, I'm not convinced this is the best way. Is there a way to
identify the exception with a unique number? Or I've seen once something
like a name for an error. Can anybody help me with this?
Thanks a lot in advance
Pieter