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
And here is @yzorg 's answer turned into a reusable extension method
public static class SqlDataReaderExtensions
{
public static DateTime? GetNullableDateTime(this SqlDataReader reader, string fieldName)
{
int x = reader.GetOrdinal(fieldName);
return reader.IsDBNull(x) ? (DateTime?) null : reader.GetDateTime(x);
}
}