Master-Detail Strategy

B

Bruce

I have a master table that I would like to display on a form with a
navigator, and I would like to display the detail records in a grid
for each master record.

Right now, I am getting all the records for both tables using
DataAdapter.Fill and a "select * from <table>" select command. I am
then setting up a DataRelation in code between the two tables.

The problem I am having is that it is taking up to 30 seconds to fill
the detail table because of it's size. Is there a way to dynamically
retrieve and display (and edit) the detail records as each master
record is displayed?

I'm using the XtraGrid from Developer's Express for the detail records
if it makes a difference.

--Bruce
 
W

William \(Bill\) Vaughn

The appropriate approach really depends on the application architecture, how
many rows we're talking about, and how widely (or if) you expect to scale
the application.
In any application, this does not make much sense as you're transporting a
great deal of data to the client--data they might never need. I suggest
creating a filtered query that returns the selected master row. Once
selected, it's easy to execute a focused query to return activity related to
that row. With this approach, a detail fetch can be done in under a second
(if the query and indexes are done correctly).

My book(s) discuss this approach in detail...

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
B

Bruce

Can you give me a little more information on this approach?

I would like for the user to be able to navigate through the master
table (I will use CurrencyManager). How would I go about fetching the
detail records for each master record? Is there an event I should be
responding to?

--Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top