This question already has an answer here:
- C# DBNull and nullable Types - cleanest form of conversion 8 answers
- Object cannot be cast from DBNull to other types error shown? 5 answers
I have this variable receiveing data from an Excel:
var employeeCedula = Convert.ToInt64(employeeRow[OverheadReportStructure.Employees.Cedula]);
but when I debug the program it shows me the error "Object cannot be cast from DBNull to other types"
How can I change that line to accept nulls?
No comments:
Post a Comment