Original Post
Hello everyone, I'm trying to filter some data in an ms access database, here is what I came up with.
command.CommandText = "SELECT codReview, reviewDate, feedbackNumber FROM tblReviews WHERE codAgent=@AgentCode";
DataTable table = DataAccess.ExecuteSelectCommand(command);
// filter data to get reviews from the specified time period
DataView t_view = new DataView(table);
t_view.RowFilter = "reviewDate >= '" + from + "' AND reviewDate <= '" + to + "'";
t_view.RowStateFilter = DataViewRowState.OriginalRows;
DataTable returnTable = new DataTable("AgentReport");
table = table.DefaultView.ToTable();
The problem is that the data is never filtered. The values from and to are passed by the function parameteres, that are selected with a datetimepicker.text property. I'm always getting all records and not getting only the ones that are within the date range I selected. Does anyone know what i'm doing wrong? Thanks in advance.