Type of conditional expression cannot be determined

Viewed 1675

i am trying to save value from dataset to List here is my code

GetPostWRTPager_Class = ds.Tables[0]
  .AsEnumerable()
  .Select(r => new GetPostWRTPager() {
     IsApproved = r["IsApproved"] == DBNull.Value 
       ? DBNull.Value 
       : Convert.ToInt32(r["IsApproved"]),
     ApprovedBy = r["ApprovedBy"],
     ApprovedOn = Convert.ToDateTime(r["ApprovedOn"]), })
  .ToList();

it is always giving me error defined below

Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DBNull' and 'int'

what is wrong in my code

1 Answers
Related