Nel

Nel

  • NA
  • 716
  • 1.1m

Specified cast is not valid

Jul 10 2012 7:07 AM
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
 

Answers (5)