title: sql date parameterized query asp classic
body: <p>I am trying to save a date to a SQL table using a parameterised query in ASP classic.</p>
  
  <p>The field is set to type date and I have tried things like</p>
  
  <pre><code>Set sqlParameters(0)=cmdCreateParameterObj.CreateParameter("@DocDate", adDbDate, adParamInput, , "20160928")
  </code></pre>
  
  <p>The error I get is</p>
  
  <blockquote>
    <p>Application uses a value of the wrong type for the current operation.</p>
  </blockquote>
  
  <p>I have tried changing adDbDate to other things but no luck so far.</p>
  
  <p>Any ideas?</p>
  
  <p>Edit - this is the function I call which appends all of my parameters stored in the array:</p>
  
  <pre><code>Function executeSQL(sqlQuery, allParameters)
  Set cmd = Server.CreateObject("ADODB.Command")
  Set cmd.ActiveConnection = DB 
  cmd.CommandText = sqlQuery 
  cmd.CommandType = adCmdText 
  cmd.NamedParameters = true 
  cmd.Prepared = true 
  For p=0 To UBOUND(AllParameters) 
  cmd.Parameters.Append AllParameters(p) 
  Next 
  Set TBL=cmd.Execute() 
  Set cmd=Nothing 
  End Function
  </code></pre>