Difficult to say with so little information, but a guess is that one of the columns in the variable
row
is set to null.
Change from
Convert.ToDecimal(row["CimplicityPatientCaseID"])
to
DBNull.Value.Equals(row["CimplicityPatientCaseID"]) ? 0 : Convert.ToDecimal(row["CimplicityPatientCaseID"])
and do the same for the other columns,
CaseID
and
PatActID
.