in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

LINQ update problem

Last post 8/30/2008 7:30 AM by Malco Malic. 7 replies.
Page 1 of 1 (8 items)
Sort Posts:
Previous Next
  • 8/18/2008 6:00 AM

    • Fé22
    • Not Ranked
    • Joined on 8/18/2008
    • Posts 8

    LINQ update problem

    Hi,

    I've a XtraGrid with a lookupEdit, this column is a external key, when changed the value of lookupEdit and save the LINQ class throw this exception:

    ForeignKeyReferenceAlreadyHasValueException

    you help me place Smile 

  • 8/18/2008 6:57 AM In reply to

    Re: LINQ update problem

     Hello,

     

    I'm not really sure - but I mean you must update the referenced Object and not the Key.

    Please use the search function, because you are not the first with that questsion.

     

    Markus

  • 8/18/2008 7:30 AM In reply to

    • Fé22
    • Not Ranked
    • Joined on 8/18/2008
    • Posts 8

    Re: LINQ update problem

    Ok,

    But my problem is:

    TabTest:

    ID: int primary

    ID_TabExternal : nvarchar(50)

     

    TabExternal

    ID_TabExternal : nvarchar(50) primary

     

    Relation: (TabExternal (one) -> TabTest (many)

    The exception is throw then changed ID_TabExternal in TabTest (the new value exists in TabExternal).

    Sorry for my horrible English.

  • 8/30/2008 3:02 AM In reply to

    Re: LINQ update problem

    I have exactly the same problem. I also tried to update the referenced object, but instead of updating the child table and its foreign key with existing record in parent table, a new record was added to it.

    Very strange. I now it has more to do with Linq rather then Devexpress components, stil I have no idea how to handle this, so I want ask here. And what I cant understand is that in many other projects I worked on, I could update my object by assigning a value to the foreign key without any problems, until now...

     

    Please help...

  • 8/30/2008 3:41 AM In reply to

    • Fé22
    • Not Ranked
    • Joined on 8/18/2008
    • Posts 8

    Re: LINQ update problem

    Hi,

    I've "resolved" the problem deleting the reference in the file dml between the two related entities (table).

    Ciao

     

     

  • 8/30/2008 4:40 AM In reply to

    Re: LINQ update problem

    You mean deleting the relation or?!

  • 8/30/2008 5:02 AM In reply to

    • Fé22
    • Not Ranked
    • Joined on 8/18/2008
    • Posts 8

    Re: LINQ update problem

    Yes but also in the dml file not in the database

  • 8/30/2008 7:30 AM In reply to

    Re: LINQ update problem

    I solved it! Now it works. The problem was that I used different DataContext objects, and that's why it couldnt recognize existing object.

Page 1 of 1 (8 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED