如何在Visual Studio Server Explorer中连接到LocalDB? [英] How to connect to LocalDB in Visual Studio Server Explorer?

查看:150
本文介绍了如何在Visual Studio Server Explorer中连接到LocalDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不敢相信,在一小时的搜索之后,我找不到一个可行的解决方案。我正在遵循实体框架6.0上的这篇文章,它简单介绍了Code First。我创建了该项目,并安装了最新的 EF Nuget软件包,以供编译。我还验证了我安装了Visual Studio 2013附带的Microsoft SQL Server 2012 Express LocalDB。我的本地计算机上没有安装任何其他SQL实例。程序运行,条目被添加到数据库并在控制台中输出。但是当文章说检查你的localdb它不会说怎么样!我没有看到在项目文件夹下创建的任何'.mdf'或'.ldf'文件。我尝试各种方式将Visual Studio的Server Explorer连接到LocalDB。该向导无法找到(localdb)或在服务器资源管理器中找不到任何提供程序来接受连接字符串,如(localdb)\v11.0;集成安全性= true; 我已经看到这个问题在StackOverflow中有几个地方,但是没有任何回答或者标记为答案。请帮忙,这不一定是令人沮丧的!

I can't believe I couldn't find a working solution to this after an hour of searching. I'm following this article on Entity Framework 6.0 which gives a simple walk-through on Code First. I created the project and installed the latest EF Nuget package for the project to compile. I also verified that I have Microsoft SQL Server 2012 Express LocalDB installed which came with Visual Studio 2013. I don't have any other instances of SQL installed on my local computer. The program runs and entries are added to the database and outputted in the console. But when the article says "check your localdb" it doesn't say how! I don't see any '.mdf' or '.ldf' files created under the project folder. I tried every way to connect Visual Studio's Server Explorer to LocalDB. The wizard cannot locate (localdb) or cannot find any provider in Server Explorer to accept connection string like (localdb)\v11.0;Integrated Security=true; I've seen this asked several places in StackOverflow but no answer works or marked as answer. Please help, this doesn't have to be this frustrating!

将Visual Studio Server Explorer连接到LocalDB的步骤是什么?

What are the steps to connect Visual Studio Server Explorer to LocalDB?

推荐答案

OK,回答我自己的问题。

OK, answering to my own question.

将LocalDB连接到Visual Studio Server Explorer的步骤



Steps to connect LocalDB to Visual Studio Server Explorer


  1. 打开命令提示符

  2. 运行 SqlLocalDB.exe start v11.0

  3. 运行 SqlLocalDB.exe信息v11.0

  4. 复制以np开头的实例管道名称:\ ...

  5. 在Visual Studio中选择工具>连接到数据库...

  6. 对于服务器名称,输入(localdb)\v11.0 。如果不起作用,请使用您之前复制的实例管道名称。您还可以使用此连接到SQL Management Studio。

  7. 在下一个下拉列表中选择数据库

  8. 单击确定

  1. Open command prompt
  2. Run SqlLocalDB.exe start v11.0
  3. Run SqlLocalDB.exe info v11.0
  4. Copy the Instance pipe name that starts with np:\...
  5. In Visual Studio select TOOLS > Connect to Database...
  6. For Server Name enter (localdb)\v11.0. If it didn't work, use the Instance pipe name that you copied earlier. You can also use this to connect with SQL Management Studio.
  7. Select the database on next dropdown list
  8. Click OK

这篇关于如何在Visual Studio Server Explorer中连接到LocalDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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