Error:A referential integrity constraint violation occurred on db.SaveChanges() in .net?

后端 未结 1 1639
醉话见心
醉话见心 2021-01-15 16:42

I have a created a WPF application with Entity framework 4.0. When i am trying to insert record in PhoneNumber Table it inserts first record succes

相关标签:
1条回答
  • 2021-01-15 16:51

    You instantiate phnumber only once and then try to insert it in the database multiple times. Move the PhoneNumber phnumber = new PhoneNumber(); phrase inside the foreach (var ph in phoneList) Block.

    0 讨论(0)
提交回复
热议问题