Link to home
Start Free TrialLog in
Avatar of MSFanboy
MSFanboyFlag for Germany

asked on

How can I find out the the rows filtered by the dataview.Rowfitler ?

Hello,

when I set a dataview with a Rowfilter, can I find out somehow what is the filtered data?

my table:

id.Name
1  mary
2 michael
3 hans
4 georg

my filter:

dataview.Rowfilter = " Name = ' michael ' ";

How can I retrieve the other 3 names without using the Rowfilter again like this:

dataview.Rowfilter = " Name <> 'michael';

HOpe the question is clear :)


Avatar of wellhole
wellhole

You can ..... Loop through the rows in dataview.Table and pick out the ones that aren't in your filtered dataview.

or

Create a second dataview and create the opposite filter on that instead.
Avatar of MSFanboy

ASKER

ah bad I told you crap...
requirements have changed actually again:

I want to enumerate through the dataview to get the each value in every row in the filtered dataview.

foreach (DataRowView row in dataview)
 {                     
    row.value doesnt work
    row.Row[3]. doesnt work // I want to get the value in the 4th column of the actual row of my dataview
 }

How can I enumerate through all Rows of the dataview and get a value of each row in a certain column?
I have to compare the one value in a dataview`s [row,column] with the value of a datareader...


I also tried this:

foreach (DataRowCollection row in dataview.Table.Rows)
{
    row. // no value or cell I get :/
}

for (int j = 0; i < dataview.Count; i++)
               {
                          var articlenumber = dataview[j].Row[3].ToString();
}


found a sample in vb and changed it to c#, pretty stupid that there is no Row.Value or Cell.Value as someone could expect it.
ASKER CERTIFIED SOLUTION
Avatar of wellhole
wellhole

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ah damn above I have a for loop with i or j, thx that you saw the error and for the snippet