在visual studio 2010上无法添加.mdf数据库 [英] On visual studio 2010 can't add .mdf database

查看:380
本文介绍了在visual studio 2010上无法添加.mdf数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算将.mdf数据库文件添加到我的asp.net项目文件中,但是添加它时显示我这个错误

连接到SQL数据库文件(.mdf)需要SQL server 2005 express或SQL server 2008 express要在本地计算机上安装并运行,当前版本的SQL server可以在这个liink上下载http:// ...但是我已经安装了完整版SQL Server 2008的内容..我现在该怎么办...?



我尝试了什么:



我安装了sql server express但是仍然无法将.mdf数据库添加到我的项目中...

I was going to add .mdf database file to my asp.net project file, but while adding it shown me this error
"Connection to SQL database files(.mdf)require SQL server 2005 express or SQL server 2008 express to be installed and running on the local computer, The current version of SQL server can be download on this liink http://..." But i have already installed full version of SQL server 2008.. What should i do now...?

What I have tried:

I installed sql server express but still can't add .mdf database to my project...

推荐答案

On Visual Studio

>转到工具

> 选项

> 数据库工具

> 数据连接

清除 SQL Server实例名称(默认为空白)选项并编写SQLEXPRESS
On Visual Studio
> Go to Tools
> Options
> Database Tools
> Data Connections
Clear the SQL Server Instance Name (blank for default) option and write SQLEXPRESS


解决方案很简单。你可以轻松地做到这一点..

在这条路径上C:\ Windows\Microsoft.NET \Framework\v4.0.30319\Config\Machine.config。基于您正在使用的.NET框架版本。有一个本地服务器数据库的条目,将数据源更改为您从.mdf文件获取数据源的名称..



目前在您的情况下,在机器中config,localsqlserver数据源名称和.mdf数据源名称似乎不同,所以错误..



希望这有帮助。
The solution is simple. you can do that easily..
On this path C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Machine.config. based on .NET framework version you are using. There is an entry to the localserver database, change the datasource to that name from where datasource you got the .mdf file..

currently in your case, in the machine config, the localsqlserver datasource name and the the .mdf data source name seem to be different and so the error..

Hope this helps.


这篇关于在visual studio 2010上无法添加.mdf数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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