title: How to pass a Null date variable to SQL Server database
body: <p>I am looking for the best practice, real solution, to send a <code>Null</code> to a SQL Server 2008 R2 database table, when a date is unknown. </p>
  
  <p>I read some inputs from a formview, and a date field maybe unknown. The database allows Null values in the field but the VB to store the Null prior to a parameterized query update is not working/eludes me.</p>
  
  <pre class="lang-vb prettyprint-override"><code>    Dim tb2 As TextBox = TryCast(FormView1.FindControl("tbPurchDate"), TextBox)
      Dim purDT As Date
      If tb2.Text = "" Then
          IsDBNull(purDT)    ' Tried this along with other possible code
      Else
          purDT = Convert.ToDateTime(tb2.Text)
      End If
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>