title: Select data based on date using SQL in C# to retrieve data from VFP db
body: <p>We are using Abra Suite Software that is using a VFP db. I have a small program in C# that I would like to use to retrieve data from the db and generate a csv file from it. At this point my problem is to get the data based on the range of date that I specified in the SQL statement. Below is my SQL statement and for whatever reason I see that there are records from 2008 (i.e. 06/09/2008). What am I doing wrong here? Because when I read how SQL works I should have been able to do "WHERE chkdate BETWEEN '2007-06-01' '2007-06-06'" but I always get 'Operator/operand type mismatch', that's why I am using CAST in my current SQL statement.</p>
  
  <pre><code>string SelectCmd = "SELECT TOP 100 p_empno, p_fname, p_lname, chknumber, chkamount, CAST(chkdate AS varchar(10)) " +
          "FROM hrpersnl " +
          "INNER JOIN prckhist ON hrpersnl.p_empno = prckhist.empno " +
          "WHERE CAST(chkdate AS varchar(10)) BETWEEN '06/06/2007' AND '06/09/2007' " +
          "ORDER BY p_empno";
  </code></pre>