SQL Visual Studio 2012 添加数据库并创建第一个名为 users 的表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14591105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 13:21:34  来源:igfitidea点击:

Visual Studio 2012 adding a database and creating first table named users

sqlvisual-studio-2012

提问by Jimmyt1988

I have Visual Studio 2012 Express and have a razor c#.net project set up.

我有 Visual Studio 2012 Express 并设置了一个 razor c#.net 项目。

I have right clicked on AppData and added a Microsoft SQL database and named it "EspressoCoffees"

我右键单击 AppData 并添加了一个 Microsoft SQL 数据库并将其命名为“EspressoCoffees”

Now I can see that it is there, I goto the Database Explorer and right click on Tables and click add table.

现在我可以看到它在那里,我转到数据库资源管理器并右键单击表并单击添加表。

The table designer comes up and I make a few columns making sure "Id" remains primary key.

表设计器出现,我创建了几列以确保“Id”仍然是主键。

  1. Where on earth do I name the table? There is a table properties panel which I can't edit the name in as it is greyed out?
  2. When I save the table it makes me choose the location for the file, what file is this? The table or the database???
  3. If I save the SQL file in the app data part... It doesn't appear under the Tables folder any way.
  1. 我到底应该在哪里命名桌子?有一个表格属性面板,我无法编辑名称,因为它是灰色的?
  2. 当我保存表格时,它让我选择文件的位置,这是什么文件?表还是数据库???
  3. 如果我将 SQL 文件保存在应用程序数据部分......它不会以任何方式出现在 Tables 文件夹下。

回答by josemiguel.torres

Just modify the name of the table in the generated T-SQL and click on the "Update" button (int the top-left corner of the tab).

只需在生成的 T-SQL 中修改表的名称,然后单击“更新”按钮(在选项卡的左上角)。

enter image description here

在此处输入图片说明

回答by akabiru

After you click update, close the design tab and hit refresh on the server explorer.

单击更新后,关闭设计选项卡并在服务器资源管理器上点击刷新。

回答by silvachathura

  1. Without creating the table use Queries to create the table
  2. Update table in T-SQL . Simple as that ....
  1. 在不创建表的情况下使用查询来创建表
  2. 在 T-SQL 中更新表。就那么简单 ....