Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

Using Local Database Files in Office Solutions Overview

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

You can include a database file, such as a SQL Server Express (.mdf) file or a Microsoft Office Access 2003 (.mdb) file, in your Microsoft Visual Studio 2005 Tools for the Microsoft Office System solution. This enables end users to maintain a local database in situations where maintaining a centralized database is not required, for example in a local inventory solution that is only used on a single computer.

Importing the Database File into a Project

To import the database file into your project, use the Data Source Configuration Wizard to create a data source based on the database file. The wizard adds the database file and a typed dataset to your project. For more information, see How to: Connect to Data in a SQL Server Express Database and How to: Connect to Data in an Access Database.

Deploying the Database File

The Data Source Configuration Wizard creates connections to the local database file using a relative path, which makes it easy to simply copy the solution from one computer to another, as long as you maintain the relative positions of the files. If you deploy your office solution to a server and then distribute the document to each end user, you must also manually distribute the database file and install it in the same position relative to the document. This means that the end user cannot move the document to a new location on his or her computer, unless he or she also moves the database file.

Local Database Files and Caching the Dataset

In Visual Studio Tools for Office solutions, you can cache datasets in the document by marking the dataset instance with CachedAttribute. When you add the database file to your project using the Data Source Configuration Wizard, a typed dataset is added to your project automatically. It is rarely necessary to use CachedAttribute on this dataset, because the data is already local on the user's computer.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.