To DataTable

Posts   
 
    
Posts: 112
Joined: 09-Aug-2004
# Posted on: 23-Nov-2004 16:32:00   

I have a customer entity. A customer can have many orders.

While doing some work I want to get a list of orders associated with that customer


Customer cust = new Customer(id);
cust.Orders();

Is there an easy way to export the collection of orders to a data table or do I need to apply a filter and use get multi as data table?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Nov-2004 18:50:45   

It's best to use the GetMultiAsDatatable() routine, as you then have to fetch it only once. You can also first fetch the orders, then create a datatable, create the columns using the Fields collection of the first Order and fill the rows with the fields[i].CurrentValue, in a loop.

Frans Bouma | Lead developer LLBLGen Pro