I am developing a console application (C # /. Net Framework 4.0 / VS2012). I created the SQL Server Compact database ( *.sdf ) and added the connection string as:
<connectionStrings> <add name="Dispatcher.Properties.Settings.FakeDataSetConnectionString" connectionString="Data Source=|DataDirectory|\FakeDataSet.sdf" providerName="Microsoft.SqlServerCe.Client.4.0" /> </connectionStrings>
But when I try to execute the following code:
SqlConnection con = new SqlConnection(); con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Dispatcher.Properties.Settings.FakeDataSetConnectionString"].ToString(); con.Open();
This gives the following exception in con.Open ():
When connecting to SQL Server, a network-related or specific instance error occurred. The server was not found or was not available. Verify the instance name is correct and configure SQL Server to connect remotely. (provider: SQL network interfaces, error: 26 - server / instance location error)
Umayr source share