I have this issue where I am receiving \"Specified cast is not valid\" no errors in the Error list inside Visual Studio. Could this error becoming from my Access Database? >
Your conjecture is almost certainly correct.
A boxed value type may only be unboxed to the type it actually is. If you have a long
in there, you can't unbox it to short?
directly. You have to unbox it to long
(or long?
) first, and then convert it to short?
.
This is a pretty frequently asked question. See my article on the subject for a detailed explanation.
http://ericlippert.com/2009/03/03/representation-and-identity/