title: SSIS Error Code DTS_E_OLEDBERROR 0x80040E21 Invalid character value for cast specification
body: <p>I am new to SSIS and just started experimenting. I am trying to figure out how to pass parameters from the ssis project to sql statement in the project. I have an sql script defined in an OLE DB data source with the access mode to the data source being an SQL command. In the where clause, I have where date between ? and ? and create two project level parameters, startdate and enddate, <a href="https://i.stack.imgur.com/woUSs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/woUSs.png" alt="enter image description here"></a></p>
  
  <p>which i want to be read into the where clause at run-time. When I run the package I get this error </p>
  
  <p>Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.
  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E21  Description: "Invalid character value for cast specification".</p>
  
  <p>Not sure where I am going wrong. Can someone please assist.</p>
  
  <p>I am <strong>NOT</strong> using execute SQL Task, I have my script in ole db source connector <a href="https://i.stack.imgur.com/buYMo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/buYMo.png" alt="enter image description here"></a></p>
  
  <p>And this is how I have my variable for the ? parameters</p>
  
  <p><a href="https://i.stack.imgur.com/qC18H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qC18H.png" alt="enter image description here"></a></p>