Query Group Dataset

  • Thread starter Thread starter Chris Thunell
  • Start date Start date
C

Chris Thunell

I have a dataset / datatable in memory and i would like to run a query
against that to create another in memory datatable or dataview. In this
case I have a bunch of data... and i want to run a 'grouping' select query
where i just get all items grouped together for example:

Existing in memory datatable (2 fields, qty and desc):
Record 1: Qty: 23 Desc: Bananas
Record 2: Qty 10 Desc: Strawberries
Record 3: Qty 23 Desc: Bananas
Record 4: Qty 18 Desc: Grapes

I want to run a group query on field 'Desc' to give me:
Record 1: Bananas
Record 2: Strawberries
Record 3: Grapes

Any ideas? I know how to do this if the data is in an sql database.. but
how do i run a query against an in memory dataset?

Thanks in advance!
Chris
(e-mail address removed)
 
Hi Chris,

The Dataset object is just a container that holds data in memory and doesn't include any functionality to do any data processing because it doesn't have any built-in query
engine. The closest you can get is by implementing this using something similar to what the following article describes:

HOW TO: Implement a DataSet GROUP BY Helper Class in Visual C# .NET
http://support.microsoft.com/?id=326145

I hope this helps!

Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
 
Back
Top