Specified cast is not valid
Hi,
Can anybody help me how to convert type object ionto decimal please?
I have this code
object rez = command2.ExecuteScalar();
iznosd = (decimal)rez;
I tried also
iznosd = (decimal)command2.ExecuteScalar();
but nothing changed, I get error "Specified cast is not valid error" in this line
iznosd = (decimal)command2.ExecuteScalar();
Thanks