'promotionschedule'上的'promotionschedule'属性无法设置为'null'值。您必须将此属性设置为类型为“system.int64”的非null值。
List<PromotionSchedule> schedule=db.PromotionSchedule.Where(t => t.PromotionsId == id).ToList();
在执行上述声明时,我们可以收到错误,例如
'promotionchedule 'PromotionSchedule'上的'property'无法设置为'null'值。您必须将此属性设置为'System.Int64'类型的非null值。
请帮帮我
谢谢你。
我尝试过:
在执行上述声明时,我们可以收到类似
$ b $的错误b'PromotionSchedule'上的'promotionschedule'属性无法设置为'null'值。您必须将此属性设置为'System.Int64'类型的非null值。
while executing the above statment we can get the error like
"The 'promotionschedule' property on 'PromotionSchedule' could not be set to a 'null' value. You must set this property to a non-null value of type 'System.Int64'."
Please help me
thank u.
What I have tried:
while executing the above statment we can get the error like
"The 'promotionschedule' property on 'PromotionSchedule' could not be set to a 'null' value. You must set this property to a non-null value of type 'System.Int64'."
鉴于缺少代码,这是最好的路线和最可能的原因。
PromotionSchedule是数据库中的一个表。看起来您正在使用实体框架,因此映射到PromotionSchedule表的实体在该表中具有promotionchedule列。在该表中,此列必须是可以为空的整数,但是您的实体映射必须将其作为不可为空的整数,这就是您遇到运行时错误的原因。
您需要使PromotionSchedule表中的列不可为空(如果sql server需要重建表),或者您需要将promotionschedule列的实体映射更改为可为空的int。因此将其更改为Nullable< int> promotionschedule
因为它当前可能是int promotionschedule
Given the lack of code here is the best route and most likley cause.
PromotionSchedule is a table in your database. It looks as though you are using entity framework so the entity mapping to PromotionSchedule table has a promotionschedule column in that table. Within that table, this column must be a nullable integer but your entity mapping must have it as a non-nullable integer which is why you are getting a run time error.
You either need to make the column in your PromotionSchedule table non-nullable (Requires rebuilding the table if sql server) or you need to change the entity mapping for promotionschedule column to be a nullable int. So changing it toNullable<int> promotionschedule
as it probably currently isint promotionschedule