I created a new item > local database. I'd like to access the data from the database but I can't open a connection. I have,

SqlConnection con = new SqlConnection("DataSource=|DataDirectory|\\testDB.sdf");

debugging will always halt at

con.Open();

I get the error
"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)"

Since I was using sqlserverCE as the database type (or something like that) I needed to include the namespace

using System.Data.SqlServerCe

but I had to add a reference to get it to be included.

This question has already been answered. Start a new discussion instead.