且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 VS2012 中无法连接到 localDB –“与 SQL Server 建立连接时发生与网络相关或特定于实例的错误..."

更新时间:2023-02-03 08:37:37

有没有可能是因为你忘记了双转义反斜杠?你试过这个吗:

Any chance it is because you forgot to double-escape the backslash? Did you try this:

"数据源=(LocalDB)\v11.0;Integrated Security=true"

或者更好的是,您可以只使用 @ 标记来禁用整个连接字符串的字符转义:

Or even better, you could just use the @ mark to disable character escaping for the entire connection string:

@"Data Source=(LocalDB)v11.0;Integrated Security=true"