views:

51

answers:

2

I have a SQL Server 2008 database that contains DateTimeOffset objects. As per 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.

However, when I use the Microsoft Sync Framework and try to sync my SQL Server database to a SQL Server Compact database, I get the following error:

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

The relevant Microsoft Sync Framework documentation is here. I am on SQL CE 3.5 SP2 and .NET Framework 4.0.

I'm kind of lost here. What am I doing wrong?

+1  A: 

What version of ADO.NET and .Net Compact Framework are you using? The docs for Sync FW v2.0 and v2.1 indicate that 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.

That is consistent with your error.

Steve Townsend
I'm running on .NET 4.0 Extended (not Client Profile).
David Pfeffer
If your versions are all in good shape - i.e. per docs, this should work - you might have to escalate this to Microsoft. From the above it seems like an area where work may have been done to add support, and maybe it's not working properly.
Steve Townsend
Some additional facts -- provisioning the client from the server works fine, and the XML stored in the database maps my column as nchar(34), which is expected. Its only when I actually call the Synchronize method does it get that error.
David Pfeffer
A: 

DateTimeOffset is not supported - the type conversions the doc mention are for Merge Replication, not Sync Framework

ErikEJ
As per http://msdn.microsoft.com/en-us/library/bb726019.aspx, DateTimeOffset conversion is supported.
David Pfeffer