我正在尝试SqlConnection
为 CE (.sdf) 数据库打开一个,但它会引发异常:
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)
我所做的是右键单击 App_Data 文件夹并在那里创建一个数据库。然后我从其属性中复制了连接字符串并将其放在 web.config 中。当我尝试“测试连接”时,它成功了。
除了连接字符串,我没有指定其他属性,如数据源、提供者名称等。
蒂亚!