Filtering strongly-typed datasets

G

Guest

Is there a way of nicely filtering a strongly typed dataset with a SQL-esque
query or somesuch? A couple of times now, I have wanted filter a dataset I
have obtained from a generic method and pull out the rows I am actually
interested in.

So far I have just relied on using a for-each loop and applying an if
statement to each row in turn to determine whether it should be used.

eg.
foreach (TypedDataSet.testInfoRow row in TestDS.testInfo.Rows)
{
if (row.State == 1)
{
//do something with the row
}
}


This is a bit lame because and you can't seem to manually create a new
filtered DS by adding datarows from the unfiltered original DS either. You
can remove. So any processing you want to do on your filtered data must be
performed in the for-each loop.

I know that in plain-old untyped datasets you can easily create a dataview
using a SQL-esque query, but of course then you lose the benefits of the
strongly typed-ness. There doesn't seem to be something like a strongly typed
dataview.

Any thoughts? In my experience, filtering data client side is quite a common
occurrence and it would be nice to get an efficient way of doing this. .NET
2.0 perhaps?

Thanks,

Tom
 

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