How is used Linq on a DataView object?

D

dclist

I can't seem to get the syntax right for invoking a Linq select
statement on a dataview object (datatable would not be ideal but
acceptable). I want to do something like the following:

var foo = from DataRow row in mydataview group row by
row['groupfield'] into x select new {field1=x['field1'],
field2=x['field2']}

foreach(var r in foo){
var myfield = r["myfield"] // use column in some way
}

I've tried different combinations of AsEnumerator, Field<string> and
using accessors instead of indexers but can't get anything to work.

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top