title: How to pass the null value to datetime datatype in asp.net?
body: <p>How to pass the null value to datetime datatype in asp.net?</p>
  
  <pre><code>cmdInsertUpdateConsultantDetails.Parameters.Add("@DateofExpiry", SqlDbType.DateTime);
  if (txtdateofexpiry.Text.Trim() == "")
  {
      cmdInsertUpdateConsultantDetails.Parameters["@DateofExpiry"].Value =
  }
  else
  {
      cmdInsertUpdateConsultantDetails.Parameters["@DateofExpiry"].Value = 
          Convert.ToDateTime(txtdateofexpiry.Text.Trim());
  }
  </code></pre>