I created a local database file (Sql Server Compact database file) in Visual Studio with the extension .sdf and I was using SqlMetal.exe to connect Linq to my Sql database file. However it gives me an error, saying that Incompatible Database Version.
Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = \\?\C:\Database\Contact\ContactDatabase.sdf ]
Consider that I have Microsoft SQl Compact Server installed, both 32 and 64 bit version and I'm running on Windows 8, 64 bit. Does anyone know how to fix it ? Thanks
You must initialize your DataContext with a SqlCeConnection object for this to work, do not use a connection string.
var connString = "Data Source=C:\data\mydb.sdf");
var conn = new SqlCeConnection(connString);
using (var context = new MyDataContext(conn))
{}