c# - 不存在从 DbType System.DateTimeOffset 到已知 SqlCeType 的映射

标签 c# sql-server synchronization sql-server-ce microsoft-sync-framework

我有一个包含 DateTimeOffset 对象的 SQL Server 2008 数据库。根据 this page ,

SQL Server Compact provides support for replicating the new data types in SQL Server 2008 such as date, time, datetime2, datetimeoffset, geography, and geometry. The new data types in SQL Server 2008 are mapped to nchar, nvarchar, image, etc. For more information about data types in SQL Server 2008, see Data Types in SQL Server 2008 Books Online Documentation.

但是,当我使用 Microsoft Sync Framework 并尝试将我的 SQL Server 数据库同步到 SQL Server Compact 数据库时,我收到以下错误:

No mapping exists from DbType System.DateTimeOffset to a known SqlCeType.

相关的 Microsoft Sync Framework 文档是 here .我正在使用 SQL CE 3.5 SP2 和 .NET Framework 4.0。

我有点迷路了。我做错了什么?

最佳答案

您使用的是什么版本的 ADO.NET 和 .Net Compact Framework? docs for Sync FW v2.0v2.1指示 wrt datetimeoffset

If the server provider is hosted on a computer that is running ADO.NET 2.0 SP1, ADO.NET 2.0 SP1 must also be available on the client for conversion to succeed. Automatic conversion of datetimeoffset on the client is not supported by .NET Compact Framework 2.0 SP1 or .NET Compact Framework 3.5.

这与你的错误一致。

关于c# - 不存在从 DbType System.DateTimeOffset 到已知 SqlCeType 的映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3793329/

相关文章:

sql - 如何加密 SQL Server 2008 数据库

c# - WCF/SQL Server 集成测试太慢?

java - 如果单例 getInstance() 方法未同步,Junit 测试将失败

java - 防止两个线程程序中的死锁

c# - 如何将 Parallel.ForEach 与列表一起使用?

c# - 从内部访问器反射(reflect)属性名称?

sql-server - 根据一个条件进行完全外连接,根据另一条件进行内连接

java - Java 中套接字的替代解决方案

c# - 接口(interface)注解

c# - 向 C# 数组添加元素