Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Approach to make DataSet remain in memory
Message
 
 
À
04/02/2010 20:53:00
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01447680
Message ID:
01447737
Vues:
32
>>Hi,
>>
>>I have the following scenario of using a lookup on a form:
>>
>>I have a user control that has a text box and a button. The user control resides on the form (call it parent form). When user clicks on the button a modal form (call them Lookup form) is opened with a grid showing data from a database table. This data is in a dataset that is retrieved from the database via call to a stored procedure. The dataset can be retrieved when the Lookup form is instantiated. The problem is that user clicks on a lookup button and selects an item from a lookup form, then closes it (moving to another control on the Parent form). So every time user clicks on a lookup button the program has to make a trip to the database to get the data.
>>
>>Is there a way to make the retrieved data set remain in the memory in order to minimize trips to the database?
>>
>>One scenario I am thinking is that the data set can be retrieved in the parent form. Then I would assign the data set to a field of the parent form. But how would the lookup form (the one called from click on the lookup button) would have this dataset "visible"?
>>
>>Any suggestions will be greatly appreciated.
>
>Just pass the dataset itself into the modal form as a parameter. You create the modal form and the dataset in the parent form, put the dataset into the modal form by reference as a param, show the form, hide the form when it is over.
>
>When you return from the modal form your dataset has a current index for the selected value as well as any other columns in that row you might need. if yo need to process something in the modal form you can assign the result to a property of the modal form and read it out after you hide the form but before you destroy it or you can pass in an object by reference that you want to store the processed result.
>
>It's an object, just pass it in and fill your datagridview with it after the modal form is instantiated.

Thank you very much. This sounds like a practical and doable approach. And as they say, the devil is in the details (kidding).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform