473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Retrieve data from dataset (newbie)

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 [TABLE] WHERE ...

... on the dataset, and write the output to the console?
Regards Søren
Aug 18 '08 #1
3 944
Soren,

You cannot use a Select on a DataSet, however there is since version 2.0 an
overloaded DataView method which does what you ask.

http://msdn.microsoft.com/en-us/library/8sd1cd0a.aspx

Cor

"Søren" <sp******@die.youngschreef in bericht
news:e5**************@TK2MSFTNGP05.phx.gbl...
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 [TABLE] WHERE ...

.. on the dataset, and write the output to the console?
Regards Søren

Aug 18 '08 #2
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" <sp******@die.youngwrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...
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 [TABLE] WHERE ...

.. on the dataset, and write the output to the console?
Regards Søren
Aug 18 '08 #3
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" <sp******@die.youngwrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...
>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 [TABLE] WHERE ...

.. on the dataset, and write the output to the console?
Regards Søren
Aug 22 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Francisco Williams | last post by:
Hi, I searched through this newsgroup looking for an answer for this, but didn't find any (it probably is here. Just didn't find it). I am trying to retrieve information from two related tables,...
4
by: Claudia Fong | last post by:
Hi, I have a form where I need to display the data of a department that stores in a access db. When I first load the form it will call a function name loaddata which will get the first...
2
by: Thomas | last post by:
Hi, I used xsd.exe to generate a *.xsd file from the *.xml-File and then I created a typed DataSet in VisualStudio 2003 But now I have problems to read the data from the DataSet. <?xml...
4
by: jay | last post by:
I am using the dataset object to add a row to a sql server database in vb.net code, as follows: dim drow as DataRow dim cmdBld as new SqlCommandBuilder(mySqlDataAdapter) ds.tables(0).NewRow()...
0
by: r1 | last post by:
I am relatively inexperienced in using delegates and asynchronous methods. I read several articles, and then I developed my own code with a mission to improve the performance. Wow! I cannot...
1
by: j.t.w | last post by:
Hi. I'm new to ASP.Net and I'm running into a simple problem (I think). I'm trying to get 2 values from 2 separate queries into 2 different variables. I would then like to take the difference...
1
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.