How to parse Nullable from a SqlDataReader

后端 未结 6 718
情歌与酒
情歌与酒 2021-01-17 17:37

The DateTime.TryParse method takes a DateTime as an argument, not a DateTime? ?

Right now I have the following code:

if(!DateTime.TryParse(reader[\"P         


        
6条回答
  •  孤城傲影
    2021-01-17 17:54

    Use the IsDBNull method of the reader to determine if the value is null prior to trying to parse a date out of it.

提交回复
热议问题