Megosztás a következőn keresztül:


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.

Note

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 (Me.IsCached("dataSet1")) Then 
        Me.StopCaching("dataSet1")
    End If
    
    if (this.IsCached("dataSet1"))
    {
        this.StopCaching("dataSet1");
    }
    

See Also

Tasks

How to: Cache Data for Use Offline or on a Server

How to: Programmatically Cache a Data Source in an Office Document

Concepts

Caching Data

Accessing Data in Documents on the Server