title: SQL Query works fine in SMS but not when executing from ORM, DateTime Conversion error
body: <p>I have the following query in C# using <code>FluentData</code> ORM.</p>
  
  <pre><code>List&lt;dynamic&gt; results = 
     Context().Sql(@"SELECT DISTINCT
                        a.EnteredDate,
                        bb.PK_EmployeeName,
                        bb.EmployeeId,
                        bb.EmployeeName,
                        dd.PK_EquipmentName,
                        dd.EquipmentId,
                        dd.EquipmentName
                     FROM 
                        dbo.PIT_Inspection a
                     INNER JOIN 
                        dbo.PIT_EmployeeName bb ON a.FK_EmployeeName = bb.PK_EmployeeName
                     INNER JOIN 
                        dbo.PIT_EquipmentName dd ON a.FK_EquipmentName = dd.PK_EquipmentName
                     WHERE 
                        CAST(a.EnteredDate AS DATE) BETWEEN '@0' AND @1'", 
                    fromDate, toDate ).QueryMany&lt;dynamic&gt;();
  </code></pre>
  
  <p>The parameters <code>fromDate</code> and <code>toDate</code> are <code>strings</code> and come populated with the following:</p>
  
  <ul>
  <li><code>fromDate</code> = "20150224"</li>
  <li><code>toDate</code> = "20150227"</li>
  </ul>
  
  <p>The area that seems to give me problem is:</p>
  
  <pre><code>WHERE CAST(a.EnteredDate AS DATE) BETWEEN '@0' AND '@1'", 
     fromDate , toDate
  </code></pre>
  
  <p>I'm receiving an error</p>
  
  <blockquote>
    <p>Conversion failed when converting date and/or time from character string</p>
  </blockquote>
  
  <p>The above line, <code>a.EnteredDate</code> is of type <code>DateTime</code>. The query I'm executing, if copied over to SQL Server Management Studio, it runs fine. I double checked that my parameter is indeed bringing in correct data, as string.</p>
  
  <p>Any idea on what causes this error?</p>