Click here to Skip to main content
14,207,436 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
List<PromotionSchedule> schedule=db.PromotionSchedule.Where(t => t.PromotionsId == id).ToList();


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'."
Posted
Updated 18-Apr-19 20:09pm
Comments
Krishna Veni 19-Apr-19 1:15am
   
promotionschedule is proprty on PromotionSchedule table

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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 to Nullable<int> promotionschedule as it probably currently is int promotionschedule
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190612.1 | Last Updated 19 Apr 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100