Link to home
Start Free TrialLog in
Avatar of dotnet0824
dotnet0824

asked on

Dataset Relation

Hi,
From my  Business Access Layer I want to expose a  Function which returns a dataset populated from Customer & Orders Table using a Stored procedure to the Client application...

The client application firstly would have a GridView populated with Customers and when a  row is clicked it has to show related ORDERS in a Detail View. So In the Business access layer should I join both of the tables and return a dataset . If so wouldnt the Dataset bound do the GridView have both customer and orders records. Thats not we want right.......... I want to do everything in BAL and just bind customer Records to the GRidview and on click  show all the child record of orders in the Details view.

So @ the BAL can code be shown how it can be done.
ASKER CERTIFIED SOLUTION
Avatar of madhevan_pillai
madhevan_pillai
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dotnet0824
dotnet0824

ASKER

so in the BAL  just a join statement is enough.............Or in the code class in BAL should i create Datarelation between both tables also?  
>>Or in the code class in BAL should i create Datarelation between both tables also?  

That would be up to you...personally...I would put in the biz layer
finally ... does that mean in my stored proc if i have a join with both the tables... and in Code do we still need dataRelation in BAL level.... Can both exist or should be opt for only  one of those
again, it's really up to you and/or circumstances...like if you have 2 very different datasources...like one a sql server table and the other a csv file or something....then the easiest way to relate the data would be in the BAL....
or you might work at a company that has a rule that all data relations have to be handled by a dba and exist in the database....
or it might depend on the amount of records...like if you have 10,000 customers each with 10,000 orders....you wouldn't want to pull one big dataset...and you really wouldn't pull 2 datasets at once and relate them either...both would mean a massive amt of data getting returned...
usually with master/detail scenarios...the common practice would be to have 2 separate functions in the BAL as well as 2 separate stored procs....
like in BAL...a "Customers" class with a  "GetAllCustomers" function that returns the customer list for the grid using one stored proc...and then a "GetCustomerOrders(ByVal CustomerID) As Orders" function that would populate your Orders object(s), but still use a stored proc that takes in the CustomerID as the param....
thanks a lot.