Extension method on SQLDataReader to check Null DateTime

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 944
public static DateTime CheckNullDateTime(this SqlDataReader dr, int ordinal)
{
return dr.IsDBNull(ordinal) ? default(DateTime) : dr.GetDateTime(ordinal);
}

Comments or Responses

Login to post response