如何在表视图上添加主键? [英] How to add Primary Keys on Table Views?

查看:928
本文介绍了如何在表视图上添加主键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2015和Entity Framework 6中使用VB.NET

I am using VB.NET with Visual Studio 2015 and Entity Framework 6

我正在开发一个Windows窗体应用程序。我正在尝试从SQL Server 2014表视图创建主详细信息表单。如何为表视图添加主键?

I am working on a windows forms application. I am trying to create a Master Detail form from SQL Server 2014 Table Views. How do do add Primary Keys for the Table Views?

我尝试删除定义查询并在.edmx中为表视图指定正确的键,但要么不是正确的方式来关联/使表格视图可编辑或我做错了。

I tried removing the defining queries and specifying the correct Keys for the Table Views in the  .edmx, but either that is not the correct way to associate/make the table views editable or I am doing something wrong.

任何指导都将不胜感激。 -ME

Any guidance would be greatly appreciated. -ME

推荐答案

嗨kingelk,

Hi kingelk,

据我所知,在SQL中, view是一个基于SQL语句结果集的虚拟表。

As far as I know, In SQL, a view is a virtual table based on the result-set of an SQL statement.

视图包含行和列,就像真实表一样。视图中的字段是数据库中一个或多个实际表的字段。因此,您无法在表视图上添加主键。只能将其添加到相关表中。

A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. So you could not add Primary Keys on Table Views. which could only add it to related Table.

祝你好运,

Cole Wu


这篇关于如何在表视图上添加主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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