Visual Studio 2008 (C#) with SQL Compact Edition database error: 26

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-01-23T19:49:47Z Indexed on 2010/05/16 1:00 UTC
Read the original article Hit count: 239

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)

I've created a SQL compact database, included it in my application, and can connect to the database fine from other database editors, but within my application im trying

using (SqlConnection con = new SqlConnection(Properties.Settings.Default.DatabaseConnection))
{
    con.Open();
}

the connection string is

Data Source=|DataDirectory|\Database.sdf

I'm stumped, any insight?

© Stack Overflow or respective owner

Related posts about c#

Related posts about visual-studio