Database is in SQL Server 2005 and the datatype of my column in question is defined as tinyint
(I cannot change this type)
I have created a model having type as Int32
. In read statement system is throwing this error.
Property could not be set to a byte value you must set the property to a non null of type int32
I was facing a similar problem for other types, then after checking CLR mapping I corrected them. Now I am facing this problem only in case of tinyint
and smallint
.
From the SQL Server docs you can see that TINYINT
is a 1 byte value which maps into .Net as a byte
type. SMALLINT
is 2 bytes which become Int16
in .Net.
So you need to change your model to use the correct types.
Simply change property data type from complex entity. In your case change property from int32 to byte .
At least it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With