• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

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 :)


0
MSFanboy
Asked:
MSFanboy
  • 4
  • 2
1 Solution
 
wellholeCommented:
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.
0
 
MSFanboyAuthor Commented:
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...


0
 
MSFanboyAuthor Commented:
I also tried this:

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

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MSFanboyAuthor Commented:
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.
0
 
wellholeCommented:
foreach (DataRowView row in dataview)
{
  row[3]          <--------- thats the value in the 4th column
}

In your above sample, it'll be best if you don't mix up i and j......
0
 
MSFanboyAuthor Commented:
ah damn above I have a for loop with i or j, thx that you saw the error and for the snippet
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now