I get the following error:
System.Data.OleDb.OleDbException (0x80040E14): Undefined function 'STR_TO_DATE' in expression.
when I run this query
SELECT
ProductCode,
Description,
SUM(Quantity) as Quantity,
STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') as DateIn
FROM
Product as P,
StockIn as S
WHERE
S.ProductNo = P.ProductNo
AND
STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "' GROUP BY P.ProductNo, DateIN ORDER BY DateIn, Description";
Try with Access SQL:
"SELECT
ProductCode,
Description,
SUM(Quantity) as Quantity,
DateValue(DateIn) as DateIn
FROM
Product as P,
StockIn as S
WHERE
S.ProductNo = P.ProductNo
AND
DateValue(DateIn) BETWEEN #" + StartDate.ToString("yyyy-MM-dd") + "# AND #" + EndDate.ToString("yyyy-MM-dd") + "# GROUP BY P.ProductNo, DateValue(DateIn) ORDER BY DateValue(DateIn), Description";
User contributions licensed under CC BY-SA 3.0