使用 Visual Studio Express 版本连接到 SQL Server [英] Connecting to SQL Server with Visual Studio Express Editions

查看:19
本文介绍了使用 Visual Studio Express 版本连接到 SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得奇怪的是,在 Visual C# 2008 Express 版中,当您使用数据库资源管理器时,您的选项是:

I find it odd that in Visual C# 2008 Express edition, when you use the database explorer, your options are:

  1. 微软访问
  2. SQL Server Compact 3.5 和
  3. SQL Server 数据库文件.

但如果您使用 Visual Web Developer 2008 Express,则可以连接到常规 SQL Server、Oracle、ODBC 等.

BUT if you use Visual Web Developer 2008 Express, you can connect to a regular SQL Server, Oracle, ODBC, etc.

对于开发命令行或其他需要与 SQL Server 数据库通信的 C# 应用程序的人,您是否真的需要使用一个 IDE(Visual Web Developer)构建您的 LINQ/数据访问代码,而您的程序在另一个(Visual Web Developer)中构建?C#)?

For people developing command-line or other C# apps that need to talk to a SQL Server database, do you really need to build your LINQ/Data Access code with one IDE (Visual Web Developer) and your program in another (Visual C#)?

这不是一个困难的解决方法,但看起来很奇怪.如果 Microsoft 想要强制您升级到 Visual Studio 以连接到 SQL Server,为什么他们会在其免费 IDE 中包含该功能而不在另一个中包含该功能?我觉得我可能遗漏了一些东西(比如如何在 Visual C# 中做到这一切).

It's not a hard workaround, but it seems weird. If Microsoft wanted to force you to upgrade to Visual Studio to connect to SQL Server, why would they include that feature in one of their free IDEs but not the other? I feel like I might be missing something (like how to do it all in Visual C#).

推荐答案

您应该能够选择 SQL Server 数据库文件选项以获得正确类型的数据库(system.data.SqlClientprovider),然后手动更正连接字符串以指向您的数据库.

You should be able to choose the SQL Server Database file option to get the right kind of database (the system.data.SqlClient provider), and then manually correct the connection string to point to your db.

我认为这些数据库选择背后的原因可能是这样的:

I think the reasoning behind those db choices probably goes something like this:

  • 如果您使用的是 Express Edition,并且没有使用 Visual Web Developer,那么您可能正在构建一个桌面程序.
  • 如果您正在构建桌面程序,并且使用的是 express 版本,那么您可能是在家工作而不是为公司进行开发的业余爱好者或 uISV 人员.
  • 如果您不是为公司开发,那么您的应用可能是面向最终用户的,而您的数据存储可能会在他们的本地机器上运行.
  • 您真的不应该将服务器级数据库部署到最终用户桌面.像 Sql Server Compact 或 MS Access 这样的进程内数据库更合适.
  • If you're using the Express Edition, and you're not using Visual Web Developer, you're probably building a desktop program.
  • If you're building a desktop program, and you're using the express edition, you're probably a hobbyist or uISV-er working at home rather than doing development for a corporation.
  • If you're not developing for a corporation, your app is probably destined for the end-user and your data store is probably going on their local machine.
  • You really shouldn't be deploying server-class databases to end-user desktops. An in-process db like Sql Server Compact or MS Access is much more appropriate.

然而,这个逻辑并不完全成立.即使这 4 点中的每一个在 90% 的情况下都是正确的,当你应用所有四点时,它也只适用于大约 65% 的观众,这意味着多达 35% 的快递市场可能有理由想要谈论到服务器级数据库,这是一个重要的群体.因此,简化(贪婪)版本:

However, this logic doesn't quite hold. Even if each of those 4 points is true 90% of the time, by the time you apply all four of them it only applies to ~65% of your audience, which means up to 35% of the express market might legitimately want to talk to a server-class db, and that's a significant group. And so, the simplified (greedy) version:

  • 真正的数据库服务器(以及运行它的硬件)要花钱.如果您可以访问它,那么您至少应该能够负担得起 Visual Studio 的标准版.

这篇关于使用 Visual Studio Express 版本连接到 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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