Casting from 'System.Int16' to type 'System.Int32'
Advertisements I encountered an error saying that "Unable to cast object of type ‘System.Int16‘ to type ‘System.Int32‘." Isn’t it too unlogical? How come? When I try the following on immediate windows, the output as such that reader.GetInt16(mycolumn_ordinal_value) 999 reader.GetInt32(mycolumn_ordinal_value) Exception thrown: ‘System.InvalidCastException’ in Microsoft.Data.SqlClient.dll At DB level (sqlserver), it is defined as mycolumn smallint. When… Read More Casting from 'System.Int16' to type 'System.Int32'