开发者

LINQ- inserting into conjoining tables

I'开发者_开发百科ve got a conjunction table, which is a one to many relationship. My LINQ code will not insert into this table because it has no primary key, even though the table is composed of just foreign keys. In addition, when I try to save the relationship for one of my foreign keys, it says that the ALTER_TABLE statement conflicts with the FOREIGN_KEY constraint. But I've checked all through both of the tables in question and there is no ALTER_TABLE anywhere.

How can I make changes that will allow me to insert into my conjunction table?


Try creating a primary key on the table, that is a composite key of the foreign key columns. LINQ-to-SQL should like that a lot better. It will allow you to keep your current structure but provide a key that LINQ-to-SQL can use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜