LINQ无法执行创建,更新或删除“表(REQ)”操作,因为它没有主键 [英] linq Can't perform Create, Update, or Delete operations on 'Table(req)' because it has no primary key

查看:499
本文介绍了LINQ无法执行创建,更新或删除“表(REQ)”操作,因为它没有主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能够在表中添加的行当表没有主键。

how i can add the rows in table when the table not have primary key.

推荐答案

你的问题的标题所说,的LINQ to SQL无法执行创建,更新或删除表操作,而主键。这是不可能的。

As your question's title says, LINQ to SQL can not perform create, update or delete operations on a table without a primary key. It's not possible.

所以,你需要或者用的 DataContext.ExecuteCommand()做的那些事,或者更好的是,重构你的数据库所以表有主键。

So, you'll need to perhaps use DataContext.ExecuteCommand() to do those things, or better yet, refactor your database so the tables have primary keys.

这篇关于LINQ无法执行创建,更新或删除“表(REQ)”操作,因为它没有主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆