SQL 2005 Express 与 2008 Express 兼容性
我安装了 VS 2008,没有 SQL 2005,然后安装了 SQL 2008,然后我需要 2005 Express,所以我重新安装了 VS 检查 SQL 功能。 安装顺利,但是我仍然无法从 VS 打开 mdf 文件。 我认为没有安装2005v实例。
当我在 VS 中双击 mdf 文件时,我收到以下消息: 与 SQL Server 文件 (*.mdf) 的连接需要 SQL Server Express 2005 才能正常运行。 请验证组件的安装或从 URL 下载:http://go.microsoft.com/fwlink/?linkID=49251。
更新
我尝试附加它,但不起作用。 当我尝试将它附加到 SQL 2008 时它不起作用,当我尝试将它附加到 VS 内的 SQL 时,我收到以下错误消息: 建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。 服务器未找到或无法访问。 验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供商:SQL 网络接口,错误:26 - 定位指定的服务器/实例时出错) 我怀疑 SQL 2005 根本没有任何实例。 我打开 SS 管理器,但没有看到任何已安装的实例。
我不知道如何安装实例,或者有没有办法用2008打开告诉我。
任何帮助将非常感激!
I installed VS 2008 without SQL 2005, then I installed SQL 2008, then I needed 2005 express so I reinstalled VS checking the SQL feature.
The installation went OK, however I still cannot open mdf files from VS.
I think there is no 2005v instance installed.
When I dbl-click an mdf file in VS I get the following message:
Connections to SQL Server Files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: http:go.microsoft.com/fwlink/?linkID=49251.
Update
I tried to attatch it, it doesn't work.
When I tried to attach it to SQL 2008 it doesn't work, when I try to attach it to SQL inside VS, I get the following error message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I suspect that SQL 2005 doesn't have any instance at all.
I opened SS manager and I didn't see any installed instances.
I don't know how to install an instance, or else if there is a way to open with 2008 tell me.
Any help will be really appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不只是在 Visual Studio 中“打开”mdf 文件 - 您需要将该文件“附加”到 SQL Server 实例,然后通过从 VS 应用程序创建 SQLConnection (System.Data.SQLConnection) 来访问它。 有关附加数据库的详细信息,请参阅此处(请注意 FOR ATTACH 选项) ),以及这里关于使用访问 SQL Server 数据的一个很好的介绍SQL连接。
哦,如果您碰巧看到任何有关“用户实例”的内容,请假装您没有看到。 它应该使自动附加数据库变得容易(事实上,附加数据库并不那么困难)。 Microsoft 警告该功能将在 SQL Server 的后续版本中停止,因此您最好只学习“正确”的方法来执行此操作。
You don't just "open" an mdf file in Visual Studio - you need to "attach" the file to your SQL Server instance, then access it by creating a SQLConnection (System.Data.SQLConnection) from your VS application. See here for more info on attaching databases (note the FOR ATTACH option), and here's a good intro on accessing SQL Server data using a SQLConnection.
Oh, and if you should happen to see anything about "user instances", pretend you didn't. It was supposed to make auto-attaching databases easy (in fact, attaching databases isn't all that hard anyway). Microsoft is warning that the feature will be discontinued in later releases of SQL Server, so you're better off just learning the "right" way to do it.