Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Approach to make DataSet remain in memory
Message
De
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:
01447688
Vues:
57
>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.


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform