title: How to pass NULL or empty strings to stored procedure input parameter with ADO and VB?
body: <p>I have a stored procedure in Sql Server 2005 with a varchar input parameter defined as:</p>
  
  <pre><code>@Value varchar(24) = NULL
  </code></pre>
  
  <p>in my VB6 application I try to set the parameter with an ADO function:</p>
  
  <pre><code>Set prmParamVal = cmdChkParam.CreateParameter(, adVarChar, adParamInput, Len(paramValue), paramValue)
  </code></pre>
  
  <p>If the value I try to pass is an empty (zero length) string, then I get the following error:</p>
  
  <blockquote>
    <p>ADODB.Connection error '800a0e7c' 
    Parameter object is improperly defined. Inconsistent or incomplete information was provided.</p>
  </blockquote>
  
  <p>I tried to pass a NULL value instead of the empty string, but this lead to different errors.</p>
  
  <p>How can I pass empty strings or NULL values to the stored procedure?</p>
  
  <p>I already read a lot of articles and searched forums (even found my question several times) but without the right answer.</p>
  
  <p>The workaround so far for the empty strings is to set the length = 1 or set the string = " " (a blank space). But thats not really nice and I would favour to send NULL. I also experimented with setting paramValue to vbNull, Null, vbNullString or to set prmParamVal.value = Empty without any luck!</p>