105
Views
2
Comments
Solved
Cannot insert duplicate key row in object
Question

In the RoomAmenities screen, there is a form that has a combo box for the user to select an amenity and then click "Save" to associate that amenity with the room.  The button "Save" has an action "Save", in this action, there is an assign with:


RoomAmenityForm.Record.RoomId = RoomId

RoomAmenityForm.Record.AmenityId = RoomAmenity.AmenityId


And then a CreateOrUpdateRoomAmenity with the Source "RoomAmenityForm.Record".


However is not working properly, when is added the first amenity to a specific room it works, but then when is added a second amenity to the room it appears an error:


 "Cannot insert duplicate key row in object 'dbo.OSUSR_V31_ROOMAMENITY' with unique index 'OSIDX_OSUSR_V31_ROOMAMENITY_6ROOMID_9AMENITYID'. The duplicate key value is (1, ). The statement has been terminated.". Do you know what can be the issue? 

2019-05-22 11-30-09
Marcelo Ferreira
Solution

Hi Oscar,

I would say that RoomAmenity.AmenityId is empty for some reason.You need to debug and confirm that. Than you need to check why is it empty and not with the value of the amenity you selected.

Regards,

Marcelo

2019-01-04 10-45-45
Sravan Vanteru

HI OsCaR_,

Looks like AmenityId is Unique and system trying to insert same value again that why is throwing error.


Sravan

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.