连接到SQL Server 2005 Express时修复实例故障

I was getting Instance Failure when connecting to my SQL Server Express 2005 Database in my C# ASP.NET application.  Very weird.

在C#ASP.NET应用程序中连接到SQL Server Express 2005数据库时,出现实例故障。 很奇怪。

Instance failure. - Windows Internet Explorer
<connectionStrings>
    <add name="NorthwindConnString" 
connectionString="Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
providerName="System.Data.SqlClient"/> </connectionStrings>

Trial and error just taught me that the problem was "Data Source=.\\SQLEXPRESS;" - It's the double \\. That's an escape sequence in C#. Everything worked when I switched the connection string to .\SQLEXPRESS.

反复试验告诉我,问题出在“数据源=。\\ SQLEXPRESS;”。 -这是双\\。 这是C#中的转义序列。 当我将连接字符串切换为。\ SQLEXPRESS时,一切正常。

翻译自: https://www.hanselman.com/blog/fixing-instance-failure-when-connecting-to-sql-server-2005-express

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值