I'm building multiple SSIS packages with BIML and i have to retrieve data from an OLE DB Source between a date interval. Here's the xml that is going to generate the packages:
<Dataflow Name="DFT Insert into <#=TableName#>">
    <Transformations>
        <OleDbSource Name="Retreive from Source (<#=TableName#>)" ConnectionName="AS400">
            <DirectInput>
                SELECT s.* 
                FROM <#=TableSchema#>.<#=TableName#> s
                WHERE s.date > ? AND s.date <= ?
            </DirectInput>
            <Parameters>
                <Parameter Name="0" VariableName="User.StartDate"/>
                <Parameter Name="1" VariableName="User.MiddleDate"/>
            </Parameters>
        </OleDbSource>
        <OleDbDestination Name="Insert into Destination (<#=TableName#>)" ConnectionName="DB2Mirror" KeepNulls="true" CheckConstraints="false">
            <ExternalTableOutput Table="[<#=TableSchema#>].[<#=TableName#>]" />
        </OleDbDestination>   
    </Transformations>
</Dataflow>
This structure would normally work, because i have already tried it but with IDs (int) instead of dates (string). The error that i'm receiving when trying to generate the package is the following:
Could not execute Query on Connection AS400
OleDbCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.
I know that i could create a ssis variable and concatenate the dates in the query as an expression, but i would like to stick with the <DirectInput> instead of the <VariableInput>
Additional information
The datetime (sorry I forgot to mention it was datetime, but i don't think it changes much) format in the variable is correct: yyyy-mm-dd hh:mm:ss. I'm pretty sure that there's nothing wrong with the format because i tried to create a variable as an expression, concatenating the dates like this: <Variable Name="Query" DataType="String" EvaluateAsExpression="true">"SELECT * FROM table WHERE col > '" + @[User::StartDate] + "'"</Variable> and it works. One thing i forgot to mention and it might be important is that the source dbms is a db2