Page 1 of 1

You must set this property to a non-null value of type 'System.Byte[]'.

Posted: Fri 24 Feb 2017 06:16
by NSY738
HI

I not sure what is the problem to cause the below error.
Hope someone here can help me on this.
Server Error in '/' Application.

The 'RowVersion' property on 'ScheduleTime' could not be set to a 'System.DateTime' value. You must set this property to a non-null value of type 'System.Byte[]'.

this problem normally occur when i using LINQ with OrderBy

Code: Select all

   List<ScheduleTime> ListScheduleTime = db.ScheduleTimes.Where(u => u.ScheduleId == Id 
                                                                    && u.BeginDay == cd.Id). 
                                                                    OrderBy(u => u.Id).ToList();
Is it not allow to use order by when select?

Thank You For HELP.

Re: You must set this property to a non-null value of type 'System.Byte[]'.

Posted: Mon 27 Feb 2017 13:56
by Shalex
Please try setting the Timestamp attribute OR the .IsTimestamp() method of Code-First fluent mapping for the ScheduleTime property. If this doesn't help, send us a small test project with the corresponding DDL/DML script for reproducing the error.

Re: You must set this property to a non-null value of type 'System.Byte[]'.

Posted: Thu 23 Mar 2017 05:59
by NSY738
HI

Thank you. the problem is because i use BigInt as key. after i change to integer then problem solved