1

I have a C# application compiled on net 4.5.

I need to create a SQL Server CE 3.5 database file because it will be used on a Windows CE 6 device.

When I create a database from code using

SqlCeEngine en = new SqlCeEngine(connectionString);
en.CreateDatabase();

it's version 4 and not compatible with net compact 3.5

How can I force the SQL Server CE version to 3.5 on net 4.5?

4

2 回答 2

2

您需要从项目中引用 System.Data.SqlServerCe.dll 的 3.5.1.0 版本,而不是 4.0.0.0 版本。

您可以从此处安装 3.5 SP2 桌面运行时:http: //www.microsoft.com/en-us/download/details.aspx?id=5783

于 2015-01-29T16:39:45.243 回答
-2

我的建议是改用 SQLite。SQL Server Compact 版本已被弃用/停止。甚至 MS 也开始推荐使用 SQLite 在 Latyer 环境中进行嵌入式开发: https ://msdn.microsoft.com/en-us/library/ee486593.aspx

SQLite 数据库在桌面/服务器端和移动端之间是兼容的。

于 2015-01-29T16:25:17.787 回答