I keep getting an error says "The given key was not present in the dictionary" when trying to retrieve a record with empty money field.
decimal estRevBase = ((Money)cloudent["estimatedvalue"]).Value;
Above code is succes when the money field is not empty. But when money field is empty,
it's returning an error.
I tried using
decimal ?
and Convert the decimal to string, to check wether the estrevbase is null or not.
decimal estRevBase = ((Money)cloudent["estimatedvalue"]).Value; string des = estRevBase.ToString(); if (!string.IsNullOrEmpty(des)) { estRev = Convert.ToDecimal(des); } else { estRev = 0 ; }
Still no luck :(
*This post is locked for comments