首页 > 解决方案 > 无法转换为不受支持的类型“DateTimeOffset”DataServiceContext

问题描述

我正在尝试使用此处DataServiceContext显示的方式更新远程表

在其他表上,这种方法对我来说效果很好,但现在我收到了这个错误:

无法转换为不受支持的类型“DateTimeOffset”

这是我的代码:

decimal hungerPercent = selectedWeight / (selectedDailyPercent * selectedPortionHeads * _batchWeight); //some calculation

var DeliveryGroup = _container.DeliveryGroups
                           .Where(x => x.GroupCode == selectedGroupCode && x.Branch == branch).First();

DeliveryGroup.HungerPercent = hungerPercent;                       

_container.UpdateObject(DeliveryGroup);
_container.SaveChanges();

表结构看起来像这样 在此处输入图像描述

标签: c#sql-serverodatadataservice

解决方案


推荐阅读