GVKun编程网logo

Visual Studio Code: 利用 MSSQL 插件创建数据库 IDE(microsoft visual studio创建数据库)

3

本文将为您提供关于VisualStudioCode:利用MSSQL插件创建数据库IDE的详细介绍,我们还将为您解释microsoftvisualstudio创建数据库的相关知识,同时,我们还将为您提供

本文将为您提供关于Visual Studio Code: 利用 MSSQL 插件创建数据库 IDE的详细介绍,我们还将为您解释microsoft visual studio创建数据库的相关知识,同时,我们还将为您提供关于(OK) Spend Leap Day with TACO + VS Code (visual studio code) - Cordova、Flutter Code 行在 Visual Studio Code 中没有正确显示树状、PYPL 1 月 IDE 榜单:Visual Studio Code 猛追 IntelliJ、PYPL 7 月 IDE 指数榜:Visual Studio Code 击败 Xcode的实用信息。

本文目录一览:

Visual Studio Code: 利用 MSSQL 插件创建数据库 IDE(microsoft visual studio创建数据库)

Visual Studio Code: 利用 MSSQL 插件创建数据库 IDE(microsoft visual studio创建数据库)

尽管面对繁重的 .NET 开发任务 Visual Studio 仍是我的首选 IDE,但我却已深深迷恋上 Visual Studio Code (VS Code),无论我使用的语言是 C#、JavaScript 还是 Node,也无论我使用的操作系统是 Windows 还是 macOS。


当然,VS Code 及其大量插件还支持其他许多语言和框架,但这些是我当前使用的工具集。


不止我一人对 VS Code 迷恋不已。在 2017 年 3 月发布 Visual Studio 2017 期间,Microsoft 就宣布了 VS Code 每月有 130 万名活跃用户。最棒的地方在于,与所有跨平台工具一样,团队中的每位成员都可以选择自己常用的操作系统,但同时所有成员仍可使用相同的编码工具。


还有就是始终都会涉及到的数据。多年来,我一直仅使用 SQL Server 和从事 Windows 应用编码。但过去几年让我大开眼界,不仅出现了新的 IDE (VS Code),还出现了新的数据库和平台(就像我正在 MacBook Pro 中键入这句话一样)。


我接触 VS Code 始于我对 Node.js 的尝试,本专栏见证了这一切。最初是在 Windows 上进行尝试。但因为 VS Code 是跨平台工具(使用 Electron 生成),所以我最终在编写同一代码时来回切换平台:有时在 Windows 中,有时在 macOS 中(将 GitHub 用作通用标准)。由于有 C# 插件和跨平台 .NET Core,我最终超越了 Node.js,使用 EF Core 在两个环境中编写 .NET Core 应用。


使用 Visual Studio 时,我非常依赖内置的 SQL Server Data Tools 和 SQL CE/SQLite Toolbox 插件来探索我的应用要创建的大部分数据。不过,使用 VS Code 时,我需要借助某种外部力量来探索数据。将 Windows 和超轻量级 VS Code 结合使用时,绝不能打开根本就不是轻量级的 SQL Server Management Studio。


对于其他数据库,无论是在 Windows 还是 Mac 计算机上,我还在一直在使用 JetBrains DataGrip (jetbrains.com/datagrip)。这一款跨平台数据库工具,支持许多数据库。


不过,随着 VS Code 插件不断增多(当我在 2017 年 4 月下旬撰写本文时,仅略低于 3,000),许多用于与数据存储进行交互的插件现已发布。我用过两个,分别是来自 SQL Server 团队的 mssql 插件 (bit.ly/2gb2ICf),以及适用于 SQLite 和 PostgreSQL 的 vscode-database 插件 (bit.ly/2mh8nYF)。


使用这些插件,可以针对数据库编写和执行 SQL。我的 Pluralsight 课程“Entity Framework Core: 入门”中对这两个插件进行了演示。 还有其他与数据相关的插件。例如,用于与 Azure Data Lake(也来自 Microsoft)、Redis 和 SalesForce 数据存储进行交互。其中一些插件仍处于预览阶段,包括 mssql 插件。


在本文中,我将介绍一些与使用 mssql 插件相关的基础知识。起初我是打算 mssql 和 vscode-database 两个都写的,但 mssql 的功能实在是太丰富了,它的探索过程充满了乐趣,对它的介绍很快就占满了本专栏的篇幅。无论是在 Windows、macOS 还是在 Linux 上使用 mssql,都不会产生任何影响。


使用 mssql 插件,可以与各种 SQL Server 数据库进行交互: Microsoft SQL Server、Azure SQL 数据库和 SQL 数据仓库。我碰巧使用的是 MacBook,我将连接外部 SQL Server。


你可能会注意到,SQL Server 现在是在 Linux 上运行,这难道不奇妙吗? 也就是说,可以启动运行 SQL Server 的 Docker 容器。虽然在本文中我不会这样做,但我对此撰写了一篇博文 (bit.ly/2qaev9r)。


而我在本文中要做的是,连接云中的 Azure SQL Server 数据库。这是一个有力的提醒。也就是说,不必是 Windows 开发者/管理员或 C# 开发者,也可以利用 SQL Server。可以在 Azure 门户上管理数据库,并能通过任意类型的应用连接数据库。


那么,假设应用是 PHP,要使用适用于 VS Code 的 PHP 插件,并与 Azure SQL Server 数据库进行通信。 


我使用免费的 Azure 帐户和 Visual Studio 订阅随附的信用额度,以 AdventureWorks 示例为依据创建了一个 Azure SQL 数据库。有关如何执行此操作的文档,请访问 bit.ly/2o2IDTy


回到 VS Code,单击 VS Code 活动栏上的插件图标,筛选出 mssql,然后单击它对应的“安装”按钮,便可安装 mssql 插件。


安装完成时,系统会提示重载 VS Code。不过,请注意,在使用此插件的命令之一前,系统会延迟安装它的部分组件。请注意,对于 macOS,需要安装 OpenSSL。有关详细信息,请单击前面提供的 mssql 文档链接。


除了已安装的查询执行引擎外,mssql 还在 VS Code 命令面板中添加了大量命令。最好先连接数据库,尽管其他功能也会提示连接(如果尚未连接的话)。


按 F1(Ctrl/Command+Shift+P,如果使用的是不含功能键的有趣键盘之一的话)打开面板,键入“MS SQL”,筛选出所有 mssql 命令。如果没有其他任何插件为命令提供 SQL 关键字,SQL 会直接解决此问题。


我喜欢的是,甚至可以使用“入门指南”命令获取帮助文件。此外,还可以存储不同的连接,然后使用“管理连接配置文件”功能轻松进行连接。


与 mssql 进行交互的最简便方法是,打开文件进行编辑,并确保 VS Code 知道你正在编辑 SQL。借助新增的查询命令,无论打开的是文件夹还是项目,都可以这样做。这会创建 SQLQuery.sql 文件,并且 sql 插件会让 VS Code 切换到 mssql 编辑器。


当前编辑器显示在 VS Code 的右下角,这因文件扩展名而异,旨在提供适当的 IntelliSense 和插件提供的其他相关功能。可以根据需要单击显示的内容进行更改。mssql 编辑器不仅会有助于编写 TSQL,还知道如何执行查询和插件定义的其他任务。


在编辑器中打开 SQL 文件后,选择“MS SQL”: 从命令面板进行连接将会列出已创建的现有连接配置文件,并允许新建配置文件。选择“创建连接配置文件”,然后系统会提示输入连接字符串的各个关键元素。


例如,第一个提示要求提供服务器名称,如图 1 所示。由于我的 SQL Azure 数据库位于 thedatafarmsqlerver.database.windows.net 服务器上,因此我将输入此名称。


 图 1:使用 mssql 插件连接 SQL 数据库


接下来,系统会提示输入数据库名称、登录名和密码以及可选的配置文件名。顺便说一下,“管理连接配置文件”也可以转到这一步,因为它具有“创建”菜单选项。


填写连接信息且成功连接后,配置文件便会保存到 VS Code 设置文件中。对于版本 0.3,如果连接失败,将不会存储配置文件;但此体验即将发生变化。从 VS Code 菜单转到“首选项和设置”或按 Ctrl/Command+,(逗号)击键组合,可查看存储的配置文件。下面的示例展示了连接配置文件:


"mssql.connections": [
  {
    "authenticationType": "SqlLogin",
    "server": "thedatafarmsqlserver.database.windows.net",
    "database": "AdventureWorksSample",
    "user": "me",
    "password": "mypassword",
    "savePassword": true,
    "profileName": "AzureAWSample"}
  }
]


在设置中存储配置文件后,可以视需要连接 AzureAWSample 或存储的其他配置文件。


连接后,便可以开始编写并执行 TSQL。执行此操作的最简单方法是,在编辑器中打开具有 SQL 扩展名的文件。正如之前所提到的,这会迫使 SQL 编辑器功能生效,其中一项非常棒的功能就是内置 TSQL 代码片段。


首先,在编辑器窗口中键入“sql”,IntelliSense 会列出内置代码片段,如图 2 所示。



图 2:mssql 插件提供的 TSQL 代码片段


可以看到,mssql 会执行允许使用的任何有效 TSQL,并不仅限查询现有数据。我要列出数据库或选定数据库中的表和视图,以验证我连接的数据库是否正确。ListTablesAndViews 代码片段非常适合执行此操作。通常,我都不得不使用 Google 和必应搜索诸如此类的 TSQL,所以我非常感谢有此代码片段。


按 Ctrl/Command+Shift+E 可执行此命令。也可以选择文本,然后右键单击调出上下文菜单,其中包括“执行”选项。


此时,包含响应的结果窗格会打开,如图 3 所示。



图 3:架构查询的结果


在右上角,你会注意到两个小图标。第一个图标用于将结果另存为 CSV 文本文件。第二个图标用于将结果另存为 JSON 格式。让我们来执行用于获取客户数据的查询,看看结果如何,然后将结果另存为 JSON 格式。


通过我面前的表列表,我可以开始键入查询。如图 4 所示,IntelliSense 启动,并且了解数据库架构。



图 4:IntelliSense 读取架构并帮助生成 TSQL


我将 select 语句修改为获取 SalesLT.Customer 中的三个列。然后,我可以突出显示此语句,并再次使用 Ctrl/Command+Shift+E 键盘快捷方式直接执行此查询。


与 SQL Server Management Studio 一样,我可以执行一个或多个语句,也可以查看一个或多个响应结果集。


结果显示在网格中,如图 5 所示。可以突出显示一个或多个行列组合,并单击 CSV 或 JSON 图标,然后系统会提示输入要保存的文件名。通过右键单击网格,可以轻松地使用上下文菜单选择所有数据。



图 5:客户数据查询结果


当系统提示输入文件名时,还会显示当前的文件夹路径。如果这就是所需的文件保存位置,则不必重新键入路径。只需键入文件名,即可将文件保存到此文件夹中。在最初的几次尝试期间,我并未意识到这一点,所以我从自己的错误中汲取了教训。


我仅选择了查询预测的客户数据的第一行,然后使用“保存为 JSON”图标,同时指定了文件名。下面展示了输出到我的文件中的 JSON:


[
  {
    "CustomerID": "1",
    "FirstName": "Orlando",
    "LastName": "Gee"  }
]


请注意,可以将自己的代码片段轻松添加到 VS Code 中。让我们来创建一个用于列出存储过程和函数的代码片段。


首先,转到“首选项和用户代码片段”。你会发现,mssql 插件添加了一个 SQL 代码片段模板。选择此模板,将会打开一个空白模板。添加更多代码片段时,将继续使用此文件。


此外,如果已创建一些代码片段要进行共享(还有可能是发现了 bug 或对 mssql 有其他想法),由于这是一个开放源代码插件,因此可以转到 github.com/Microsoft/vscode-mssql,提交拉取请求或问题,从而参与进来。


在长时间使用 Google 和必应进行搜索并测试各种想法后,我创建了下列代码片段,用于列出目标数据库中的所有存储过程和函数:


"List Stored Procedures": {
  "prefix": "sqlListStoredProcedures",
  "body": [
    "SELECT [Name],[Type_Desc] " ,
    "FROM [sys].[all_objects] " ,
    "WHERE ([Type] = ''P'' OR [Type]=''FN'' OR [Type]=''TF'' OR [Type]=''IF'') ",
    "AND [Is_MS_Shipped] = 0"  ],
  "description": "List Stored Procedures"}


现在,当我在编辑器窗口中键入“sql”时,就可以使用 sqlListStoreProcedures 选项了。对目标数据库执行此命令的结果如下:


Name                         Type_Desc
uspPrintError                SQL_STORED_PROCEDURE
uspLogError                  SQL_STORED_PROCEDURE
ufnGetAllCategories          SQL_TABLE_VALUED_FUNCTION
ufnGetSalesOrderStatusText   SQL_SCALAR_FUNCTION
ufnGetCustomerInformation    SQL_INLINE_TABLE_VALUED_FUNCTION


通过右键单击结果网格并选择“连同标题一起复制”选项,我可以共享此输出。


正如午夜电视广告所说,“且慢! 还有更多精彩内容!” 编辑器窗口也有上下文菜单(见图 6)。



图 6:编辑器窗口上下文菜单


恕我直言,其中最有趣的项目是“转到定义”和“速览定义”。如果在编辑窗口中选择表名称(例如,图 5 所示命令中的“Customer”),这些命令会显示客户表的 CREATE 脚本。


mssql 插件在不断发展,我期待将来有更多更新。我在这里分享的版本 0.3.0 仍处于预览阶段。如果已在 Visual Studio Code 上安装此版本,将会收到更新通知。若要掌握和参与它的发展历程,请访问 GitHub 网站 (aka.ms/mssql-marketplace)。




Julie Lerman 住在佛蒙特州的丘陵地区,担任 Microsoft 区域主管、Microsoft MVP、软件团队导师和顾问。可以在全球的用户组和会议中看到她对数据访问和其他主题的介绍。她的博客地址是 thedatafarm.com/blog。她是“Entity Framework 编程”及其 Code First 和 DbContext 版本(全都出版自 O’Reilly Media)的作者。通过 Twitter 关注她:@julielerman 并在 juliel.me/PS-Videos 上观看其 Pluralsight 课程。


衷心感谢以下 Microsoft 技术专家对本文的审阅: Kevin Cunnane、Eric Kang 和 Sanjay Nagamangalam

原文地址:https://msdn.microsoft.com/zh-cn/magazine/mt809115


.NET社区新闻,深度好文,微信中搜索dotNET跨平台或扫描二维码关注

本文分享自微信公众号 - dotNET跨平台(opendotnet)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

(OK) Spend Leap Day with TACO + VS Code (visual studio code) - Cordova

(OK) Spend Leap Day with TACO + VS Code (visual studio code) - Cordova


http://taco.tools/articles/leap-day.html

15 Feb 2016 - by Linda

This year, we all have an extra day to spend doing whatever we want. So, why not take 15min to learn to build an iOS, Android and Windows app all at once?

This exericise introduces you to the core components of a Cordova app and how to create one in VS Code.

You in? Let’s go.

1. Setup

1.1 Install Visual Studio Code from the VS Code website, code.visualstudio.com.

VS Code is our lightweight, multi-screen code editor with the intellisense and debugging support of the Visual Studio IDE. This is the main tool we will use to create our Cordova project.

1.2 Install Apache Cordova, Ionic Framework, and the Tools for Apache Cordova CLI.

Enter into the Windows command prompt: npm install -g cordova ionic taco-cli

Or, enter into the Mac terminal: sudo npm install -g cordova ionic taco-cli

These are the three main tools we will use in VS Code.

  • Cordova is open source platform for building native mobile applications using HTML, CSS, JS.

  • Ionic is a front end framework for developing native-looking mobile apps built on top of Angular JS.

  • Tools for Apache Cordova is a product built at Microsoft that makes setting up and getting started really easy. It abstracts away the tool chain needed to test your app, and includes features like kits to make migrating to new versions of Cordova easy.

2. Get an App Going

2.1 Create your app: In the command promt, navigate to the directory in which you want your project to live, and type the command ionic start myLeapDay. This will create a basic Ionic app called myLeapDay using the default tabs template.

This walkthrough uses Ionic framework to create a basic, native-looking Cordova app.

2.2 Add and remove platforms using taco-cli

Enter your new Cordova project by typing cd myLeapDay into the command prompt and ls to explore the file structure of your project. If you type cd platforms, you will see that Ionic already has added iOS to the platforms folder, so you can build your Cordova app into an iOS app.

Now, add an Android app to your project by typing taco platform add android into the command prompt. That will mean that your Cordova project will now try to build into Android and iOS.

2.3 Play around!

Check out what your app looks like by deploying it in a browser. Navigate back to the root of your project, and type ionic serve into the command prompt to open myLeapYear in a lightweight emulator running in your web browser. (Unfortunately, you can only see the iOS version).

3. Turn this basic app into a collection of golf balls in VS Code

Now, we will use VS Code to start poking around inside your project. Open VS Code, then go to File > Open, and navigate to the folder where you can see myLeapDay. Click on the folder (but not into it!) and press open.

You can see in the screenshot that your project should have a platforms/android folder, which you added using taco-cli.

The app itself exists in the www/ folder. You can see all the parts of a traditional website in this folder:

  • css/ holds the an empty style.css, where you can add your own styling
  • img/ holds images and other site assets
  • js/ holds all the logic of the Angular JS project–essentially the core of the app
  • lib/ holds the Ionic framework files that acts as scaffolding for this project
  • templates/ holds the extra pages/html files shown in the app
  • index.html, the landing page and where the app begins

3.1 Download this zip of web assets from this post. Unzip the folder and drag all the images to the www/img/ folder of your project.

3.2 Modify the landing page of the app. In templates/tabs.html, you see all three tab categories shown on the naviagtion bar. The dashboard tab links to an ion-nav-view called tab-dash. In templates/tab-dash.html, replace the file with the one in the zip folder, leapday/tabs-dash.html. Deploy using ionic serve to see the change.

3.3 Add golf ball data. In js/services.js, there is test data called var chats. We are going to take advantage of the existing formatting to replace each chat with a golf ball, and add some new fields like category and dimensions. Replace the js/services.js with leapday/services.js.

Deploy to your browser again using ionic serve, and click on the chats tab to see the change. In particular, notice that the chats are now replaced with golf ball data. Tapping a golf ball takes you to the templates/chat-detail.html page, where you can see that the golf ball pictures are a bit skewed. On to the next step!

3.4 Fix formatting and using new fields.

Replace the file with the one in the zip folder, leapday/chat-detail.html. It replaces the line , allowing each golfball to have its own custom dimensions that we set in services.js.

Now, to customize the detail screen further, go to chat-detail.html and try adding the following line of code right above the <p> {{ chat.lastText }} </p> element: <h2>Pattern category: {{ chat.cat }} </h2>

4. Bonus: Deploy to a virtual Android device

Since you have been viewing the app in its iOS form, let’s take a look at how it looks in Android.

4.1 Navigate to the root of your project and enter taco install-reqs android into the command prompt. This will install the dependencies needed to build and deploy your Cordova app into the standard Android emulator (Android SDK and Java 7, update 55).

4.2 Open the Android SDK manager using the command android sdk (sudo android sdk on a Mac). Check the following boxes for Android 5.0.1 (API 21)

4.4 Enter android avd (sudo android avd on a Mac) to open the Andriod AVD manager, click “Create” and set up an Android virtual device. Be sure to specify an AVD name, Device, Target, and CPU/ABI

4.5 Return to the terminal, and at the root of your project, emulate using the command taco emulate android (or sudo taco emulate android)

5. Pat yourself on the back

You did it!! You’ve built your first Cordova app, viewed it on two different platforms, and are ready to hit the road. Please let us know how you enjoyed this brief tutorial, and what you’d like to see next.

And we would love to hear about how you enjoyed your time in VS Code. Send feedback by clicking on the smile in the bottom-right corner of the code editor.

Until next time,

Linda Zhong Program Manager | Tools for Apache Cordova
Microsoft Visual Studio
lizhong@



Flutter Code 行在 Visual Studio Code 中没有正确显示树状

Flutter Code 行在 Visual Studio Code 中没有正确显示树状

如何解决Flutter Code 行在 Visual Studio Code 中没有正确显示树状

我正在 Visual Studio Code 中开发 Flutter 应用程序。 Flutter 代码应该一步一步地以树状方式正确显示。 但是树线是在word里面输入的,看起来很乱。 这是屏幕截图。

Visual studio code tree problem

如何解决?请

注意:我在可视化代码中安装了这些扩展。

visual studio code extensions

PYPL 1 月 IDE 榜单:Visual Studio Code 猛追 IntelliJ

PYPL 1 月 IDE 榜单:Visual Studio Code 猛追 IntelliJ

PYPL 1 月 IDE 指数榜单已发布,前三名依然是 Visual Studio、Eclipse 和 Android Studio 。

可以看到,榜单其实有着明显的 “阶梯”:第四名至第十名和前三强的占比差距悬殊,但也和后面的工具保持着距离。

Visual Studio Code 在 2018 年 6 月还处于第十名,当时的占比为 3.47% ,如今已超越 Xcode、Atom、pyCharm、Sublime Text ,升至第六名,并不断拉近与第五名的 IntelliJ 的差距。

前三强历年指数走势如下:

IntelliJ、Visual Studio Code 和 Sublime Text 的指数趋势图:

PYPL 指数是非常流行的参考指标,它的原始数据基于 Google trends 。Top IDE Index 是 PYPL 通过分析用户在 Google 上搜索不同 IDE 的次数而生成的,某个 IDE 被搜索的次数越多,则认为其越受欢迎,该榜单可以被开发者用来参考决定使用哪个 IDE 进行项目开发。

完整榜单见官网:Top IDE index

PYPL 7 月 IDE 指数榜:Visual Studio Code 击败 Xcode

PYPL 7 月 IDE 指数榜:Visual Studio Code 击败 Xcode

PYPL 7 月最新 IDE 指数已发布,搜索最多的前三大 IDE 依然是 Visual Studio、Eclipse 和 Android Studio 。其中,Visual Studio 和 Eclipse 的指数再次拉近,仅相差 0.7% 。

前 10 名中,Xcode 连续下降,在上个月被 PyCharm 反超后,本月又被 VS Code 打败。其他名次未变。

PS:趋势是与去年 7 月对比


PYPL 指数是非常流行的参考指标之一,原始数据基于 Google trends 。“ Top IDE Index” 是 PYPL 通过分析在 Google 上搜索 IDE 的频率(次数)而生成,IDE 被搜索越多,则认为越流行。

当然,需提前说明的是,人们搜索某物不绝对代表他们喜欢它。同理,被搜索最多的 IDE 并不一定意味着一定最受欢迎。

排名前三的 Visual Studio、Eclipse 和 Android Studio 走势图:

VS Code 和 Xcode 走势图:

完整的排名请查看:Top IDE index

今天的关于Visual Studio Code: 利用 MSSQL 插件创建数据库 IDEmicrosoft visual studio创建数据库的分享已经结束,谢谢您的关注,如果想了解更多关于(OK) Spend Leap Day with TACO + VS Code (visual studio code) - Cordova、Flutter Code 行在 Visual Studio Code 中没有正确显示树状、PYPL 1 月 IDE 榜单:Visual Studio Code 猛追 IntelliJ、PYPL 7 月 IDE 指数榜:Visual Studio Code 击败 Xcode的相关知识,请在本站进行查询。

本文标签:

上一篇安装 mssql-server-linux(安装指纹锁需要多少钱)

下一篇.NET 开源 MSSQL、Redis 监控产品 Opserver 之 Redis 配置(开源redis监控工具)