How to: Programmatically Stop Caching a Data Source
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
You can programmatically remove a data object from the data cache in a document by calling the StopCaching method of a host item, such as a Document, Workbook, or Worksheet. The StopCaching method is private, but it appears in IntelliSense.
Do not call StopCaching from the event handler for the Shutdown event of a document or worksheet. By the time the Shutdown event is raised, it is too late to modify the data cache. For more information about the Shutdown event, see Visual Studio Tools for Office Project Events.
To stop caching a data object
Call the StopCaching method of the document or worksheet instance and pass in the name of the data object. This example assumes that you have a DataSet named dataSet1 that you want to stop caching.