Conversion from type"DBNull" to type"Double" is not valid

after reading an excel I need to multiply column (0) by -1 I did it with assign row (0) = Convert.ToDouble (Convert.ToInt32 (row (0)) * -1), but “error” conversion from type "comes out DBNull “to type” Double “is not valid” how to solve it?

Make sure that row(0) value is not empty. it should contain some value before conversion.

Regards,
Karthik Byggari

1 Like

hi @Manoli_Puente

check the data in the column is null in the initial part like
row(0).tostring.trim.equals("")

if true don’t do the action , if not ,do the multiplication

Regards
Ajay