问题
I programmed an application with an attached .mdf
database file that works fine on my computer. But on another computer (client PC) I get this error message :
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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)] System.Data.SqlClient.SqlInternalConnection
Should I install SQL Server Express on my client PC? It's just impossible, can you please help ?
Thanks in advance
回答1:
If you want to use a .mdf
SQL Server database file, you must install at least SQL Server Express on that machine - or put the database on a SQL Server instance in the network the PC is connected to and use the database on the server.
You cannot use a .mdf
database file totally without installed SQL Server - SQL Server is not an embedded database that works without installation. If you require such a database, look at SQLite, SQL Server CE (Compact Edition) or something like RavenDB. Those can be embedded (as a set of DLL's) into your solution and work against files on disk without need of installing a server component on the machine where they run.
来源:https://stackoverflow.com/questions/36704628/localdb-in-visual-studio-2015-error-52-sql-server