I am using C # and SQL Server 2005, and I need a recommendation on how to populate my objects.
I have a Customers collection containing a collection of client objects. Each customer object contains a collection of orders containing a collection of orders.
I use the public Fetch () method in my Customers collection to populate customers and their orders.
You can have only one DataReader for each connection, correctly. Thus, this would mean that I need one connection for the "SELECT * Customers" reader, and while I repeat through the customer reader, I will need another connection for each "SELECT * Orders WHERE CustomerId_fk = @Id".
My question is: Would you recommend me to use the above method or just a DataSet?
EDIT
I had "SELECT" clients WHERE Id = @Id 'Instead of "SELECT * Customers".
source
share