Advertisement

04.29.2008 at 01:59PM PDT, ID: 23363637
[x]
Attachment Details

Master/Detail --- backgroundworker question.

Asked by dogsdieinhotcars in Microsoft Visual C#.Net, C# Programming Language, .NET Framework 2.0

Tags: C#, 2.0

I have a form that has a master and detail tables on it.  As you page through the master table, I want to populate the detail table on a background worker.  
So I have the background worker _DoWork fill a data reader object and then the _RunWorkerCompleted update the datagrid with the populated data reader.
This works fine so long as the background worker has completed before you go to the next master record.

I started using a timer where the detail records were not populated unless you rested on one master record for more than 0.1 seconds... Which worked great performance wise -- so if the user is scanning through records, why incur the sql overhead of doing queries for the detail records that will never be viewed... But that didn't fix the problem of the background worker already existing.

So next I tried destroying the background worker if it wasn't complete and recreating it.  That worked except when you cycled really quickly between records.  So next I tried close the data reader, then destroying the background worker, the data reader, and then forcing garbage collection.  Even that didn't work --- .NET throws an error of "There is already an open DataReader associated with this Command which must be closed first." --- in the debugger the DataReader  in question shows to be closed.

So my question is:  How do I accomplish what I want to do?  How can I have slowly queried detail records that can be ignored or discarded (without slowing down the UI) when they are no longer relevant since the master record moved?Start Free Trial
 
Loading Advertisement...
 
[+][-]04.29.2008 at 02:29PM PDT, ID: 21466376

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 02:39PM PDT, ID: 21466436

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 02:42PM PDT, ID: 21466460

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 10:03PM PDT, ID: 21468194

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, C# Programming Language, .NET Framework 2.0
Tags: C#, 2.0
Sign Up Now!
Solution Provided By: CyrexCore2k
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.29.2008 at 10:04PM PDT, ID: 21468198

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.30.2008 at 01:47AM PDT, ID: 21468990

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628