Table is nullable DateTime, but DataSet throws an exception?

前端 未结 9 1242
悲哀的现实
悲哀的现实 2020-12-13 14:42

I\'m attempting to use the DataSet designer to create a datatable from a query. I got this down just fine. The query used returns a nullable datetime column from the datab

9条回答
  •  忘掉有多难
    2020-12-13 15:10

    I am using the code listed below to handle null cells in an Excel sheet that is read in to a datatable.

    if (!reader.IsDBNull(0))                                
    {                                    
      row["DateOnCall"] = (DateTime)reader[0];
    }
    

提交回复
热议问题