我使用这个连接字符串为我的项目:连接字符串错误
Server=.\\SQLExpress;AttachDbFilename=D:\\Database.mdf;Database=Database;Trusted_Connection=Yes;user instance=true;
,但执行时,我的程序得到了一个错误:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
你DATABSE名称是“数据库”这是我见过最糟糕的数据库名称:) – Mehmet
该文件是否存在于D:\\磁盘中?同时检查文件是否存在访问问题 - 检查权限。 – msporek
是这个'\\ SQLExpress'就是你的实例名称 –