I'm working on a c# application with a sql server 2005 database. what is the best way to convert to decimal a value brought to a datareader from a database, not knowing if the value that is coming from the base is a decimal or is a bigint ?
if (dataReader.IsDBNull(0) == false) {
PLAYER.PLAYER_ID = dataReader.GetDecimal(0);
}
In my PLAYER object, PLAYER_ID is decimal type.
I use two different databases, therefore, the value that comes from the base can be bigint or decimal. If this is decimal thete's no problem, but if it's a bigint, i get an error.