Filter Issue

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I thought after I set the "RowFilter" property on a dataview, that if I then
interated through the view, that I would only see those rows which met the row
filter. I am not finding that to be the case. I am putting values in the
rowfilter that I know are not present, yet when I iterate through the
dataview, I see all rows. What am I doing wrong?

The second question has to do with RowFilterState. If I want to see the
modified version of all rows, but not deleted, and all rows which have never
been modified what is the proper setting for the RowFilter Property?

Here is my code, for what it is worth...

dvProfileDirectory.RowFilter = "UserID = '" & "Bugs" & "' and ProfileNameID =
" & profile_lastProfileNameSelected & " and ProfileType = '" & "BUG" & "'"
dvProfileDirectory.RowStateFilter = DataViewRowState.ModifiedCurrent
If dvProfileDirectory.Table.Rows.Count > 0 Then


The row count in the If statement is always the total number of rows in the
table.



Thanks in advance for your assistance.
 
I see a few things.

I, you are checking the number of rows in the table which
stays constant (unless you make a trip back to the db).
If you use dvProfileDirectory.Count, that will tell you
how many records are in the filtered view.

As far as the string goes, unless it was just for
testing...you don't need the concatenation if you are
using a hard coded string...this won't hurt anything but
it's more verbose.

dvProfileDirectory.RowFilter = "UserID = 'Bugs' and
ProfileNameID =" & profile_lastProfileNameSelected & " and
ProfileType = 'BUG'"

I think you might have to use two row filters or
manipulate them at different times. I'm not to sure about
this though.

Good Luck,

Bill

W.G. Ryan
 
Back
Top