Share via


Adding a Database Reference to a Database Project

If you are working on a database project in Solution Explorer, you can add a database reference. A database reference contains connection information and is saved as part of the project.

To add a database reference to a database project

  1. In Solution Explorer, right-click the Database References folder and choose New Database Reference from the shortcut menu.

    The Add Database Reference dialog box appears with a list of current database connections.

  2. Choose an existing database connection and skip Steps 3 – 4.

    -or-

    Click Add New Reference to make a new connection. The Data Link Properties dialog box appears.

  3. On the Provider tab of the Data Link Properties dialog box, choose an OLE DB provider. For example, to connect to a SQL Server 2000 database, choose Microsoft OE DB Provider for SQL Server.

  4. On the Connection tab of the Data Link Properties dialog box, provide the requested information.

    The OLE DB provider you choose on the Provider tab affects what controls are visible on the Connection tab. For example, if you choose Microsoft OLE DB Provider for SQL Server in Step 3, the Connection tab includes selections for the server name, type of authentication, and the database name.

  5. Click OK to establish the connection.

After you successfully add the connection, it appears in the Data Connections node in Server Explorer and the Database References node in Solution Explorer.

See Also

Setting a Default Database Reference for a Database Project | Deleting a Database Reference from a Database Project | Database Connections and Database References | Managing Data with Database Projects