Code to parse a SQL Result into list of datatables

  • Thread starter Thread starter Sam Shrefler
  • Start date Start date
S

Sam Shrefler

Is there any code part of the .NET Framework or any suggestions at the
best way to handle the following situation?

Results from SQL Select statement:

MeasureDate | Name | Width | Height
01/01/07 | Flower | 10 | 10
01/01/07 | Tree | 11 | 11
01/01/07 | Bush | 12 | 12
02/01/07 | Flower | 11 | 10
02/01/07 | Tree | 12 | 11
02/01/07 | Bush | 13 | 12

I'd like a way to create the following structure:

A List (myList) that holds dataTables based on MeasureDate:

myList['01/01/07'] would hold a datatable

Flower | 10 | 10
Tree | 11 | 11
Bush | 12 | 12

Does that make sense?

Thanks

Sam
 
Sam,

All you really need is a DataView for this. You can create two separate
DataViews on the same table, and set the filter on one to have a MeasureDate
of 1/1/07, and the filter on the other DataView to be a MeasureDate of
2/1/07. Then, you can use the DataView instances like you would DataTables.

Hope this helps.
 
Back
Top