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
 

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

Back
Top