Поделиться через


How to: Connect to a Database from Server Explorer

The Visual Database Tools allow you to make changes to an existing database with Table Designer or Database Diagram Designer, and run queries with Query and View Designer. In order to access these features, you must first establish a connection to an existing data source.

Note

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 connect to a database from Server Explorer

  1. From the View menu, choose Server Explorer.

  2. In Server Explorer right-click the Data Connections node and choose Add Connection.

  3. If this is the first connection you make, the Choose Data Source dialog box appears. In this dialog box under Data Source choose the kind of data source to which you are connecting, and then under Data Provider choose the provider appropriate for the application you are working with. Finally click Continue.

  4. In the Add Connection dialog box enter the requested information.

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

  5. Click the Advanced button to bring up a list of properties where you can change settings for the selected provider.

  6. 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.

  7. Click OK.

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

See Also

Other Resources

Understanding Visual Database Tools

Overview of Visual Database Tools

Database Connections and Database References