Hi All,
I am tring to Insert a record in the Navision table.
I have Table and its Primary key is ID field and its auto increment field.
FADPrice is table fields are - ID, Description, Quantity, Amount.
My code is,
FADPrice.INIT;
FADPrice.Description := '12201-RAA-A0000-H1 Cyl HD';
FADPrice.Quantity := 1256;
FADPrice.Amount := 0;
FADPrice.INSERT;
FADPrice.INIT;
FADPrice.Description := 'Delta For RAA Cylinder Heads';
FADPrice.Quantity := 4563;
FADPrice.Amount := 0;
FADPrice.INSERT;
Its getting me error like ID no already exits when its tried to insert second record.
Can any one tell me why ?? what I am doing wrong.
JAYESH PATEL
0
Answers
So, how can I find what was last ID ?
That's why I cann't assign ID in the code.
Its assign ID automatically for first time insert code, but only second time I get that error message.
The first insert works fine and sets the ID (e.g. = 10 ). The next INIT does not reset the primary key so the insert is tring to insert ID = 10 again. Set the ID := 0; and it should work fine
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
I have assigned ID = 0 in the Code, Its work fine.
Thank you very Much
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html