Retrieve data from dataset (newbie)

  • Thread starter Thread starter Søren
  • Start date Start date
S

Søren

Hi guys

I hope this is the correct news group. If not .. then please point me in
the right direction.

Ok - to the problem:


I´ve got a dataset with a table that contains some rows. How to I
execute a sql statement like this:

SELECT DISTINCT [ROW] FROM
WHERE ...

... on the dataset, and write the output to the console?


Regards Søren
 
Hi Søren,

If you are using VB 2008 you can use LINQ to Dataset, eg.

Dim customers As DataTable = ds.Tables("Customer")

Dim query = From cust In customers.AsEnumerable() _
Where cust.Field(Of String)("LastName") ="Smith" _
Select cust Distinct

Look for "LINQ to Dataset" for more examples.
 
Thanks. That was just what I needed. :-)

Regards Søren


Bill McCarthy skrev:
Hi Søren,

If you are using VB 2008 you can use LINQ to Dataset, eg.

Dim customers As DataTable = ds.Tables("Customer")

Dim query = From cust In customers.AsEnumerable() _
Where cust.Field(Of String)("LastName") ="Smith" _
Select cust Distinct

Look for "LINQ to Dataset" for more examples.





Søren said:
Hi guys

I hope this is the correct news group. If not .. then please point me
in the right direction.

Ok - to the problem:


I´ve got a dataset with a table that contains some rows. How to I
execute a sql statement like this:

SELECT DISTINCT [ROW] FROM
WHERE ...

.. on the dataset, and write the output to the console?


Regards Søren
 
Back
Top