I am getting error when I am trying to open connection. My DB.sdf file is in my application folder
here i stored db.sdf
{
string ConnectionString= new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + @"\APP_DATA\DB.sdf";
public int ExecuteNonQuery(string query){
int res = -1;
try
{
using (SqlCeConnection conn = new SqlCeConnection(ConnectionString))
{
SqlCeCommand command = new SqlCeCommand(query, conn);
command.CommandType = CommandType.Text;
conn.Open();
res = command.ExecuteNonQuery();
}
}
catch (Exception e)
{
new Logs().TraceProcessError(e.Message);
}
return res;
}
}
Error:
You are trying to access an older version of a SQL Server Compact Edition database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe. If this is a SQL Server Compact Edition 3.0 or later database, run Compact / Repair. [ Db version = 3505053,Requested version = 3004180,File name = D:\DB.sdf ]"
and I am using SQL Server Compact 3.5., VS2010, SQLServer 2008R2.
please help. thanks.