Windows 7, Visual Studio 2010, tagert framework = .NET 4 Client Profile
I’m creating a desktop application, completely local, it doesn’t access servers. For that i’m using a .MDF SQL Server database and LINQ. Everything works fine on my machine, however, when i deploy it, the following error is shown when i try to connect to the database:
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)
Here are info which might be useful for you guys:
Project file structure:
\myapp.exe
\data\bdapepuc.mdf
Connection string: Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Data\BDApepuc.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True
The machine to be the deployed only has the .NET 4 Client Profile installed, nothing else.
Thanks for your help, this error is really spanking me. Change suggestions are welcome too
Edit:
I corrected the connection string, i had pasted the wrong one, please check it.
So far i tried (including tips from you guys here) without success:
- Relative path, like:
AttachDbFilename=\Data\BDApepuc.mdf - Installing sql server compact 3.5 SP2
It does, it accesses a SQL Server Express server. You’ll have to deploy that as well. You could include the bootstrapper for it in your Setup project. Or just download it from Microsoft.