This documentation is archived and is not being maintained.

How to: Add a Database to a Device Project

The following steps assume that you have a SQL Server Compact 3.5 database available in Server Explorer. For more information, see How to: Create a Database (Devices).

NoteNote:

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To add a SQL Server Compact 3.5 database as a data source

  1. With a smart device project open, click Add New Data Source on the Data menu.

  2. On the Choose a Data Source Type page, select Database, and then click Next.

  3. On the Choose Your Data Connection page, select the data connection string that contains the name of your database, and then click Next.

    This connection is displayed in the drop-down box if your database is already available in Server Explorer. If your database connection does not appear in the list, click New Connection to open the Add Connection dialog box, click Browse to open the Select SQL Server Compact 3.5 Database File dialog box, locate your database, and then click Open. Then click OK to close the Add Connection dialog box.

  4. On the Choose Your Data Connection page, click Next.

    The Local database file message box appears, inquiring whether you want to include your data file in your current project.

    Click Yes.

  5. On the Choose Your Database Objects page, select the objects you want to use as data sources in your project.

  6. Click Finish.

    Objects you have selected from your SQL Server Compact 3.5 database are displayed as data sources for your project in the Data Sources window. To open the window, click Show Data Sources on the Data menu.

Show: