Re: How to identify an error?
From: One Handed Man \( OHM#\) ("One)
Date: 06/10/04
- Next message: Tal: "Re: How to identify an error?"
- Previous message: cody: "Re: Can I get a instance from type?"
- In reply to: DraguVaso: "How to identify an error?"
- Next in thread: Tal: "Re: How to identify an error?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Jun 2004 09:51:19 +0100
One way around this is to set the column seed to -1 and count down. This way
when the new records are inserted you will not get duplicates assuming your
records are all positive.
However, I would recommend that if possible you dump this idea and use
GUID's which are extremely reliable as far a uniqueness is concerned ( not
totally though ).
Regards - OHM
"DraguVaso" <pietercoucke@hotmail.com> wrote in message
news:OlPwtMsTEHA.2464@TK2MSFTNGP10.phx.gbl...
> 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
>
>
>
- Next message: Tal: "Re: How to identify an error?"
- Previous message: cody: "Re: Can I get a instance from type?"
- In reply to: DraguVaso: "How to identify an error?"
- Next in thread: Tal: "Re: How to identify an error?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|