Marcel
Marcel

Reputation: 927

Get values of tablerow - dataset Windows CE

I have a dataset with a table called "product". this has 3 columns: coding, amount & description.

I want to search a product which I identify by "coding". My Code looks like this:

DataTable table = ds.Tables[0]; // = "Product"
string expression = coding.ToString(); 

var filtered = table.AsEnumerable()
            .Where(r => r.Field<String>("Coding").Equals(expression));

How can I now select for example the matching description for storing it into a variable?

Upvotes: 0

Views: 196

Answers (1)

hamg
hamg

Reputation: 36

Filtered is not one table row it's a list of table rows. You can iterate throw them and do further operations.

foreach (var row in filtered)
        {
            Console.WriteLine("{0}, {1}, {2}", row["coding"], row["amount"], row["description"]);
        }

Upvotes: 2

Related Questions