Caching Data in the Workbook

A data cache is a place where you can store and retrieve data within a document. VSTO allows you to cache data in an Excel workbook. This feature is useful when you bind data to a document and want to let users update the data while they are not connected to a server that contains the database. VBA developers often use a hidden sheet to store data that they don't want to have visible in the document. Now this data can be stored in the data cache. Cached data is stored in a hidden ActiveX control on Sheet1, known as the Runtime Storage Control.

At design time, you can cache data in the document in two ways. The first way is to set the CacheInDocument property of the instance of the dataset to True in the Properties window. The second way is to add an attribute named <Cached> to an object or to the declaration of a variable that contains the data to be cached. At run time, you can call the StartCaching method on the worksheet and pass the dataset to be cached. Chapter 13 has more about using data caching in documents on a server.

0 0

Post a comment