I'm trying to run a query on an Access DB, I'm used to SQL queries but this doesn't seem to be working the same way. Here's my query:
OleDbCommand command = new OleDbCommand();
command.Connection = connect;
command.CommandText = "SELECT RecordID, TimeStamp, EmployeeName, AreaDescription FROM LoginRecords r, Employees e, Areas a WHERE((e.EmployeeID = r.EmployeeID) && (a.AreaID =r.AreaID) && (TimeStamp > startDate AND < endDate)) ORDER BY TimeStamp;"
I can't seem to get this to run but technically from a SQL standpoint this should be a good query. The tables are LoginRecords, Employees, Areas. I can load the tables if that would be helpful. I appreciate any feedback as to why this won't work in Access. And startDate and endDate are variables from user input boxes.
(TimeStamp > startDate AND < endDate). Unless MS Access has weird SQL syntax parsing, that doesn't look very structured. The overall mix ofANDand&&probably isn't good either. Maybe stick with one (AND) and be more explicit in that parenthetical statement, something like:(TimeStamp > startDate AND TimeStamp < endDate).