none
LinqToSQL ForigenKey Exception RRS feed

  • Question

  • I have a LinqToSQL class setup with two tables T001 and T003_CodeDescription

    I have set an association from T003 to T001 on three columns Period,MasterCode,SubCode

    I have setup a DataGridView in Virtual mode and and I can change the value in T001 Period,MasterCode,SubCode until I scroll to a column that uses information from the T003 table then if I try and change the values I get a ForeignKeyReferanceAlreadyHasValueException. From what I have read I would need to change the T001.T003_CodeDesctiption to the new value I want. This would be fine if I only linked on one Column but as I link on three columns I can't see a way to change this option.

    thanks

    Daivd

    • Moved by CoolDadTx Monday, May 21, 2012 2:05 PM LINQ related (From:Visual C# General)
    Monday, May 21, 2012 11:32 AM

All replies

  • Hi Daivd,

    I guess you set the Period,MasterCode,SubCode as ForeignKeys which linked with T003 and you want to change the values in T003 after the ForeignKey changed in T001, please correct me if I’m wrong and let us know the detailed requirement against this issue.

    Also you could share us with the code snippet or screenshot with this issue.

    Best Regards,


    Tony Xiao [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 22, 2012 10:22 AM
    Moderator