title: How to manage parsing an null object for DateTime to be used with ADO.NET as DBNULL
body: <p>I have two DateTime objects, BirthDate and HireDate. They are correctly formatted as a string and when I pass them through to my data access layer, they need to be parsed into a DateTime object. </p>
  
  <pre><code>DateTime hD = DateTime.Parse(hire);            
  DateTime bD = DateTime.Parse(birth);
  
  //incase of a datestring being passed through
  dateStringPassed = "7/2/1969";
  </code></pre>
  
  <p>But sometimes, the strings <code>hire</code> and <code>birth</code> are null or empty <code>""</code>, if the code is run like this, I get a FormatException error from Parsing a empty string. How can I manage empty parses and allow the DateTime, if empty or null, be accepted as <code>DBNull.Value</code>? </p>
  
  <p>I still cannot manage incase the user does not pass through a DateTime string, then the parse crashes my code.</p>
  
  <p>My parameter for birth date is as follows and checks the variable if null, then use DBNull.Value. </p>