Skip to content Skip to sidebar Skip to footer

Error In Connection To Database

The following code gives an error during execution. string connectionString = 'Data Source=D:\\Base.sdf;Persist Security Info=False'; SqlConnection sqlConnection = new SqlConnectio

Solution 1:

Your database is a Sql Server compact edition one, you must use :

SqlCeConnectionsqlConnection=newSqlCeConnection(connectionString);

Download the libs from here Microsoft SQL Server Compact 4.0

  1. Add a reference to System.Data.SqlServerCe.dll to your project
  2. Add this using directive using System.Data.SqlServerCe;
  3. Use SqlCeConnection instead of SqlConnection

Post a Comment for "Error In Connection To Database"