title: Set date field to null
body: <p>I am trying to set a date field to null in a MS SQL Server 2005 database.</p>
  
  <p>I am using VBScript on asp pages.</p>
  
  <p>The column in the DB allows for nulls. But when I try to add a record and not pass anything along to the date field, or try to set the field back to Null, I get this error:</p>
  
  <blockquote>
    <p>Provider error '80020005'</p>
    
    <p>Type mismatch.</p>
    
    <p>/add_client_notes.asp, line 142</p>
  </blockquote>
  
  <p>Line 142 is: <code>rs("client_notes_duedate") = client_notes_duedate</code></p>
  
  <p>Here is all the code:</p>
  
  <pre><code>&lt;% 
      clientnotes_id = request("clientnotes_id")
      client_notes_duedate = request("client_notes_duedate")
      if client_notes_duedate = "" then
          client_notes_duedate = Null
      end if
  
      openSQL("SELECT * FROM client_notes WHERE client_notes_id=" &amp; clientnotes_id)
      rs("client_notes_duedate") = client_notes_duedate
      rs.update
  
  %&gt;
  </code></pre>
  
  <p>I have tried sending an empty value and a NULL value but both return the same error.</p>
  
  <p>When I send the date value along it works great.</p>
  
  <p>How can I set client_notes_duedate back to NULL?</p>