Export (0) Print
Expand All

How to: Programmatically Stop Caching a Data Source

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • 2007 Microsoft Office system

  • Microsoft Office 2003

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.

NoteNote:

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.

    if (this.IsCached("dataSet1"))
    {
        this.StopCaching("dataSet1");
    }
    

Community Additions

ADD
Show:
© 2014 Microsoft