Share via


How to: Add a SQL Server 2005 Reference

Use the Connect to Database command to add a SQL Server 2005 database reference to your Visual C++ project. This command opens either the Choose Data Source dialog box or the Add Connection dialog box.

To add a database reference to your C++ project

  1. Open your SQL Server Project.

  2. On the Tools menu, click Connect to Database.

    If this is the first connection you make, the Choose Data Source dialog box appears.

    1. In this dialog box, under Data source, select Microsoft SQL Server.

    2. Under Data provider, choose the provider appropriate to the application you are working with.

    3. Click Continue.

  3. In the Add Connection dialog box, enter the requested information.

    This information is different for each provider. For more help on this dialog box, click the Help icon at the top of the dialog box or press the F1 key while the dialog box is selected.

  4. Click Advanced to display a list of properties that enable you to change settings for the selected provider.

  5. Click Test Connection to check the connection without closing the dialog box. This way you can make adjustments to the settings if the connection does not succeed.

  6. Click OK.

    Your connection appears in Server Explorer under the Data Connections node.

See Also

Tasks

How to: Connect to a Database from Server Explorer

Reference

SQL Server Project Template

Add Database Reference Dialog Box

Choose/Change Data Source Dialog Box

Add/Modify Connection (Microsoft SQL Server)