Skip to main content
gamedev.net
🔒 Locked

[.net] DataTable + DataView

Started by BrasiLokau Jun 18, 2007 at 9:24 PM 0 replies 1k views
Original Post
BrasiLokau
BrasiLokau
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.
blog: www.brasilokau.com/games/blog

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.