I have written a c# wpf application that talks to a SQL Server 2012 LocalDB on my machine.
To make the app accessible on other peoples machine's I have:
- Included the database file in a zip for the user to extract to the programs directory.
- Written SQL scripts to attach the database to the local machine's LocalDB instance.
The application works perfectly fine on my machine, however after installing on someone else's computer (after the .NET and SQL Server 2012 LocalDB prerequisites have been installed), it keeps filling up the error logs with the following message:
Exception: 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).
Now there are a lot of other references to the same error message, but I cannot find any that relate to LocalDB or what to try with LocalDB.
Keeping in mind the application is designed for the common 'end-user', so I can't have them following numerous instructions to use SQL Server Management Studio or configuration manager.
The attach SQL script is as follows in case you need to know:
CREATE DATABASE BaseDB
ON (FILENAME = 'C:\MyApp\Base\MyDB.mdf'),
(FILENAME = 'C:\MyApp\Base\MyDB.ldf')
FOR ATTACH;
Can anyone suggest why this wouldn't be working?