You're checking for the wrong exception...

Pieter

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Osterburg
Sent: 25. oktober 2005 17:42
To: [email protected]
Subject: Re: SV: [development-axapta] Catching DB dupicate key erros

same problem.

Thomas Jensen schrieb:
> Hi Stefan
>
> Try catching Exception::Error instead.
>
> Regards
> Thomas
>
> -----Oprindelig meddelelse-----
> Fra: [email protected]
> [mailto:[EMAIL PROTECTED] På vegne af Stefan
> Osterburg
> Sendt: 25. oktober 2005 11:03
> Til: [email protected]
> Emne: [development-axapta] Catching DB dupicate key erros
>
> Hello,
>
> when inserting possibly duplicate records into a table I don't want to
> check for an existing record each time before I insert but catch the
> error that the insert-call throws.
>
> The following is supposed to fill cust with two records (4711 and
> 4712) and catch the error thrown on the second 4711, however it does not work.
> What do I need to change?
>
>    custtable cust;
>     cust.setTmp();
>
>     cust.clear();
>     cust.AccountNum="4711";
>     cust.insert();
>
>     cust.clear();
>     cust.AccountNum="4711";
>     try
>     {
>         cust.insert();
>     }
>     catch (exception::Deadlock)
>     {
>      continue;
>     }
>
>     cust.clear();
>     cust.AccountNum="4712";
>     cust.insert();
>
>
>     while select cust
>     {
>      info(cust.AccountNum);
>     }
>
> Stefan Osterburg
>
>
>
>
>

> Yahoo! Groups Links
>
>
>

>
>
>
>
>

> Yahoo! Groups Links
>
>
>

>
>





------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links












YAHOO! GROUPS LINKS




Reply via email to