I have the following code to connect to a sql server compact edition 2008:
private SqlConnection sqlConn;
public void createConnection()
{
String connectionString = @"Data Source=C:\Projects\somefile.sdf;Persist Security Info=False";
sqlConn = new SqlConnection(connectionString);
sqlConn.Open();
}
However, I keep getting the following error when sqlConn.Open()
is executed:
"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)"
Does anyone have any ideas what the problem might be? I can create a connection to the db in the database explorer but it doesn't seem to work in code.