Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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

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
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900