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
- Visit your group "development-axapta" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

