5
Answers

Specified cast is not valid

Nel

Nel

12y
2.1k
1
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)