0

I have a solution that has spontaneously started generating the error "Invalid object name 'Item_id'". I have searched for this but all answers seem related to code first issues around pluralization; my project is database first.

The context is that there is a Purchase with a collection of ItemPurchaseLines which are linked to Items. The error occurs when a new purchase is generated, this generates new ItemPurchaseLines and either links them to existing Items or generates new Items. The mapping between ItemPurchaseLines and Items is via a foreign key on Item_Id to Id respectively.

I have regenerated the model from the database and the relationships/column mappings all look good.

Any help, or any further information you need, would be appreciated.

Edit I have built a LinqToSql alternative and it gives exactly the same error.

4

1 回答 1

0

好吧——我是个彻头彻尾的白痴!

我完全忘记了我在相关表中添加了一个触发器来更新 pl_Items 表,但我没有使用正确的表名,而是使用了 Item_Id。

所以 VS 的代码都很好,它是后面的 SQL 触发器,这把事情搞砸了!

于 2013-11-07T23:50:55.110 回答