How to write SqlConnection in ASP.NET MVC?
習慣沉默
習慣沉默 2017-05-16 17:05:20
0
2
440
 using (var connection = new SqlConnection(@"server=127.0.0.1;database=dbname;uid=sa;password=1234567890"))
            {
                 connection.Open();
                 try
                 {
                 ……

that is

System.ComponentModel.Win32Exception: 找不到网络路径。   

or

System.Data.SqlClient.SqlException: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL Network Interfaces, error: 50 - 发生了 Local Database Runtime 错误。无法创建自动实例。有关错误详细信息,请参阅 Windows 应用程序事件日志。

still have a question

Data Source=(LocalDB)\v11.0

If written like this, does it refer to the local database? What version is 11.0?

習慣沉默
習慣沉默

reply all(2)
大家讲道理

Already solved. Change to

server=.

That’s it

阿神

Isn’t it popular to use ef in mvc now? Still using sql?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template