Ling To Sql:数据库版本不兼容



我在Visual Studio中创建了一个扩展名为.sdf的本地数据库文件(Sql Server Compact数据库文件),并使用SqlMetal.exe将Linq连接到我的Sql数据库文件。然而,它给了我一个错误,说数据库版本不兼容。

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:DatabaseContactContactDatabase.sdf ]

考虑一下,我安装了Microsoft SQl Compact Server,包括32位和64位版本,并且我在Windows 8、64位上运行。有人知道怎么修吗?感谢

必须使用SqlCeConnection对象初始化DataContext才能正常工作,不要使用连接字符串。

var connString = "Data Source=C:datamydb.sdf");
var conn = new SqlCeConnection(connString);
using (var context = new MyDataContext(conn))
{}

最新更新