完整的错误消息如下:
(46,12):错误2019:指定的成员映射无效。类型'HotelSearch.APP_SEJOUR'的成员'SEJ_STARDATE'的类型'Edm.String [Nullable = True,DefaultValue =,MaxLength = Max,Unicode = True,FixedLength = False]'与'SqlServer.date [Nullable =类型'CodeFirstDatabaseSchema.APP_SEJOUR'的成员'SEJ_STARDATE'的True,DefaultValue =,Precision = 0]。(47,12):错误2019:指定的成员映射无效。类型'HotelSearch.APP_SEJOUR'的成员'SEJ_ENDDATE'的类型'Edm.String [Nullable = True,DefaultValue =,MaxLength = Max,Unicode = True,FixedLength = False]'与'SqlServer.date [Nullable =类型'CodeFirstDatabaseSchema.APP_SEJOUR'的成员'SEJ_ENDDATE'的True,DefaultValue =,Precision = 0]。(112,12):错误2019:指定的成员映射无效。类型'HotelSearch.RFS_PRIX_R'的成员'PRIX_PRICE'的类型'Edm.String [Nullable = True,DefaultValue =,MaxLength = Max,Unicode = True,FixedLength = False]'与'SqlServer.date [Nullable =类型'CodeFirstDatabaseSchema.RFS_PRIX_R'的成员'PRIX_PRICE'的True,DefaultValue =,Precision = 0]'。
代码如下:
var h = new Hotel();
var t = new APP_STAR {
STA_IDSTAR = 11111,
STA_STARRATING = "blah",
};
h.APP_STAR.Add(t);
h.SaveChanges();
显然,这只是用于测试的虚拟数据。谁能为我指出正确的方向,以解决此错误?
错误消息非常清楚:
The type 'Edm.String' of member 'SEJ_STARDATE' in type 'HotelSearch.APP_SEJOUR' is not compatible with 'SqlServer.date
通过操作edm.String的内容或使用DateTime.Parse将其更改为可识别的日期时间格式(MM / DD / YYYY)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句