What is the best way to query my dataset from VB.net?

I have a VB.Net dataset containing data from multiple tables. Does anyone have any good suggestions on how to query data from a dataset. I want to run SQL-like queries in a dataset to retrieve data that matches a specific " where ".

+4
source share
3 answers

Use the DataTable.Select() method.

Here is some information from the official MSDN documentation .

As subsequent reports say, Linq is another option and will probably give you much more versatility that you might not need depending on your own requirements.

+9
source

If you are using .NET 3.5, you can use LINQ to DataSet .

Basically you use DataTableExtensions.AsEnumerable (extension method) to access strings as IEnumerable<DataRow> , and then you can use regular LINQ for Object Operators. DataRowExtensions make this easier.

If you use a strongly typed DataSet , the queries look even better.

I prefer this option over DataTable.Select - everything that fiddles with escaping, formatting string requests, etc., seems like a real step backwards.

+6
source

You should try using Linq.

It will provide you many opportunities to query your objects.

try to get more information here: http://msdn.microsoft.com/en-us/netframework/aa904594.aspx

Or Google for Linq for DataSets

+2
source

All Articles