在查找 2 个日期之间的范围时出现“12”运算符错误后缺少操作数

Missing operand after '12' operator error on finding the range between 2 dates

我在执行以下代码时遇到错误 "Missing operand after '12' operator"。

employee.Select(Table.Key + " = '" + dept.Key.ToString() + "' AND " +  Table.EnteredDate + "BETWEEN" + startDate + "AND" + endDate)))
employee.Select(Table.Key + " = '" + dept.Key.ToString() + "' AND '" +  Table.EnteredDate.ToString("yyyyMMdd") + "' BETWEEN '" + startDate.ToString("yyyyMMdd") + "' AND '" + endDate.ToString("yyyyMMdd") + "'")))

希望它有效。您的输入不足。

下面的代码有效!

employee.Select(Table.Key + " = '" + dept.Key.ToString() + "' AND " + Table.EnteredDate + " >= '" + startDate.ToString("yyyyMMdd") + "' AND " + Table.EnteredDate + " <= '" + endDate.Value.ToString("dd/MM/yyyy");