A DataStore is a nonvisual DataWindow control. DataStores act just like DataWindow controls except that they do not have many of the visual characteristics associated with DataWindow controls. Like a DataWindow control, a DataStore has a DataWindow object associated with it. DataStores can be used in Windows and Web applications.
DataStores are useful when you need to access data but do not need the visual presentation of a DataWindow control. DataStores allow you to:
Perform background processing against the database without having to hide DataWindow controls in a window
Suppose that the DataWindow object displayed in a DataWindow control is suitable for online display but not for printing. In this case, you could define a second DataWindow object for printing that has the same result set description and assign this object to a DataStore. You could then share data between the DataStore and the DataWindow control. Whenever the user asked to print the data on a form, you could print the contents of the DataStore.
Hold data used to show multiple views of the same information
When a window shows multiple views of the same information, you can use a DataStore to hold the result set. By sharing data between a DataStore and one or more DataWindow controls, you can provide different views of the same information without retrieving the data more than once.
Many of the methods and events available for DataWindowControls are also available for DataStores. However, some of the methods that handle online interaction with the user are not available for either DataStores or WebDataWindowControls, which use a DataStore internally. For example, DataStores support the Retrieve, UpdateData, InsertRow, and DeleteRow methods, but not FindNextSelectedRow and SetRowFocusIndicator.
When you are working with DataStores, you cannot use functionality that causes a dialog box to display to prompt the user for more information. Here are some examples of when this can occur:
Prompt for Criteria You can define your DataWindow objects so that the user is prompted for retrieval criteria before the DataWindow retrieves data. This feature works with DataWindowControls only. It is not supported with DataStores.
Prompt for Printing For DataWindowControls, you can specify that a print setup dialog box display at runtime, either by checking the Prompt Before Printing check box on the DataWindow object’s Print Specifications property page, or by setting the DataWindow object’s Print.Prompt property in code. This is not supported with DataStores.
Retrieval arguments If you call the Retrieve method for a DataWindowControl that has a DataWindow object that expects an argument, but do not specify the argument in the method call, the DataWindow prompts the user for a retrieval argument. This behavior is not supported with DataStores.
Unlike DataWindowControls, DataStores do not require any visual overhead in a form. Using a DataStore is therefore more efficient than hiding a DataWindowControl in a form.