tags:

views:

31

answers:

1

Hello, I have a VB.Net function which executes a Oracle Stored Proc and returns a dataset. Below is a list of sample records

OrderID  OrderDetail Qty   Date        Supplier Price
1          Books      10   10-Aug-08   ABC Inc    100.00
1          Pens       20   10-Aug-08   ABC Inc    300.00
2          Keys       1    20-Aug-09   Blue cross 100.00
2          Nots       3    30-Aug-09   Blue Cross 200.00

The above records are returned as a dataset in my function.

Using the above dataset int two different functions how can I return data as shown below.

  1. First function should return only distinct orderID records
  2. Second function should take OrderID as input and return records based on orderID

Any suggestions?

Thanks

A: 

For the select distinct, check out Select DISTINCT on DataTable. For the other, use the DataTable.Select method. Assuming that the DataTable is the first in the DataSet ...

var dt   = ds.Tables[0];
var rows = dt.Select( "OrderID = 1" );

(Sorry, I don't know any VB :)

JP Alioto