Ali_dotNet
Ali_dotNet

Reputation: 3279

error connecting to sql server compact file in VS2012

I use following connection string for connecting to my SQL Server Compact database (.SDF file) in a VS 2012 (.NET 4) Win form app:

SqlConnection SQLConnection = new SqlConnection("Data Source=d:\\mydb.sdf;");

but I get following error, what is going wrong?

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)

Upvotes: 0

Views: 165

Answers (1)

mrówa
mrówa

Reputation: 5781

Use SqlCeConnection instead of SqlConnection.

Upvotes: 2

Related Questions