20 April 2017

System.InvalidCastException: Specified cast is not valid.

When you try to map bigint in SQL to int in C#, you will get an error equivalent to "System.InvalidCastException: Specified cast is not valid."

You need to map the bigint to long, which is equal to 64-bit integer in C# or Int64, because Int32 cannot store the maximum value of bigint.

No comments:

Post a Comment