4

The column in SQL Server 2008 is [tinyint] NULL

The property on the class in C# is short?

I am just doing a simple select query.

In Dapper .NET 3.5 it worked perfectly.

I recently updated to .NET 4.0, and to Dapper .NET 4.0, but now I get the following DataException:

{"Error parsing column 3 (COLUMNNAME=30 - Byte)"}

InnerException:

{"Invalid cast from 'System.Byte' to 'System.Nullable`1[[System.Int16, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'."}

Any ideas why this is trying to convert as a byte?

EDIT: If I change the property to short it works fine.

Adam Marshall
  • 3,010
  • 9
  • 42
  • 80

1 Answers1

1

OK. If I change the property of Byte? it works fine.

This answer seems to suggest it is the correct type to use: https://stackoverflow.com/a/968734/1061602

Community
  • 1
  • 1
Adam Marshall
  • 3,010
  • 9
  • 42
  • 80