![]() |
#1 |
Участник
|
We recently received a few interesting requests about an error code appearing under particular circumstances: 85132273. This error might typically arise with the Windows Client but also with Web Services and NAS Services as well.
Digging under the hood, this error message is related to a Primary Key violation in SQL Server tables. In most of cases, this could be due to C/AL code such as the following: IF NOT MyTable.INSERT THEN … This is quite an easy and diffuse syntax that looks innocent and clean (admittedly, we even have a few instances of it in the CRONUS demonstration database). However, it is a problematic use of code because it forces an INSERT into a table and if the record already exists, an implicit error is thrown. That gives us that violation of the primary key. From a development perspective, we recommend that you refactor the code, where possible, in the following way (under a LOCKTABLE): IF NOT MyTable.GET THEN MyTable.INSERT … This code is preferable for at least two reasons:
Please use the attached page object only for testing and understanding, and do not use it on a live environment. It is just to demonstrate the error code in a standard CRONUS demonstration database. ![]() These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. Duilio Tacconi Microsoft Dynamics Italy Microsoft Customer Service and Support (CSS) EMEA Special thanks to Peter Elmqvist from nabsolution.se Источник: http://feedproxy.google.com/~r/Micro...tatements.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|