title: Date error when updating sql database using vb.net 2010 pro
body: <p>I get the following error when trying to update my sql database.</p>
  
  <blockquote>
    <p>SqlDateTime over flow must be between 1/1/1753 12:00:00 AM and
    12-31-9999 11:59:59 PM</p>
  </blockquote>
  
  <p>In SQL I have my UP_DATE field set to <code>datetime2(0)</code></p>
  
  <p>Below is my class setup. I removed some info to shorten this question up.</p>
  
  <pre><code>Public Class Riders
  Private m_RIDER_NO As Integer
  Private m_UP_DATE As Date
  
  Public Property UP_DATE() As Date
      Get
          Return m_UP_DATE
      End Get
      Set(ByVal value As Date)
          m_UP_DATE = value
      End Set
  End Property
  </code></pre>
  
  <p>In my update function code:</p>
  
  <pre><code>If IsDate(newRider.UP_DATE) Then
          updateCommand.Parameters.AddWithValue("@NewUP_DATE", newRider.UP_DATE)
   Else
          updateCommand.Parameters.AddWithValue("@NewUP_DATE", DBNull.Value)
  End If
  </code></pre>
  
  <p>Now if I change my class to the below it works fine, as a STRING sql excepts the update.</p>
  
  <pre><code>Private m_UP_DATE As String
  
  Public Property UP_DATE() As String
      Get
          Return m_UP_DATE 
      End Get
      Set(ByVal value As String)
          m_UP_DATE = value
      End Set
  End Property
  </code></pre>
  
  <ol>
  <li>Anyone know if this is exceptable or will I run into problems later on.</li>
  <li>Why dose sql except the updates when I have set my UP_DATE field to string in VB, and as datetime2(0) in sql.</li>
  </ol>