【未解决】:VS2008配置数据源之要求安装SQL Server Express 2005才能正常工作

本文详细记录了在Visual Studio 2008中遇到的SQL Server Express数据库连接问题及尝试的各种解决方案,包括修改配置文件和调整实例名称。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

按照教程的步骤,我在App_Data文件夹中添加一个数据库文件,但是系统报如下错误信息:


经过才网络中搜索,发现先行者的记录:

Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component ...
I've got this error message while trying to add a Database file into a c# website project :-s .
After a bit googling it appears that Visual studio 2005 is trying to connect to a SQLSERVEREXPRESS instance name, and yes this can be change easily, if like me, you have change this name during SQL server express 2005 installation. here we go:

In visual studio 2005, open the Tools menu
click on the "Options" item
Select the "Database Tools" node
Select the "Data Connections" child node

then you have a text box with the following label:
"SQL server Instance Name (blank for default):
"SQLSERVEREXPRESS"

for me it was just a matter of leaving it blank, and then adding a mdf file to the project is just working fine :-D
I've not found the solution anywhere else, I must be stupid... anyway, hope it helps someone.


于是到VS2008中去修改:
(注意,要将左下角的“显示所有设置”的复选框选上,否则看不到“数据连接”项)
将右边的SQLEXPRESS删除,确定。
 
我将SQLEXPRESS使用MSSQLSERVER替换。
但是,问题没有解决。
再搜索,发现如下方法:
You may open your Machine.Config file (the file is in %SystemRoot%\Microsoft.NET\Framework\ver. number\CONFIG ). Try to find the ConnectionString node, modify the setting and make it look like:

<add name="LocalSqlServer" connectionString="data source=.\MSSQLSERVER;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

备注:红色字体原来为“.\SQLEXPRESS”

尝试下来,还是没有成功!始终报相同的错误信息。
郁闷中ing...... 盼望高手给与指点一二......

转载于:https://www.cnblogs.com/chunshen/archive/2009/08/15/1545873.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值