Udostępnij za pośrednictwem


How to: Add New Data Connections in Server Explorer/Database Explorer

Server Explorer/Database Explorer displays database connections beneath the Data Connections node. After a connection is established, you can design programs to open connections and retrieve and manipulate the data provided, or directly access and work with the data using Visual Database Tools.

Note

In the Visual Studio Express products, this window is named Database Explorer. In all other Visual Studio products, this window is named Server Explorer.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To add a data connection in Server Explorer/Database Explorer

  1. On the Tools menu, choose Connect to Database.

    The Choose Data Source dialog box opens. For more information, see Choose/Change Data Source Dialog Box.

    Note

    The Choose Data Source dialog box only appears the first time you create a connection. The selected data source becomes the default for each subsequent connection.

  2. Select the type of data source to connect to from the Data source list. Click Continue and the Add Connection dialog box opens. The Add Connection dialog is specific to the data source selected in the previous step. For more information, see Add/Modify Connection Dialog Box (General).

    Note

    If the Add Connection dialog box is not set to the correct data source click the Change button to open the Choose Data Source dialog box and select a different data source.

  3. Enter the information required to connect to the selected data source and click OK to create the connection.

    The Add Connection dialog box closes, and the new data connection appears beneath the Data Connections node.

    For example, if you create a data connection to a database called Northwind on a server named Server1, a new connection named Server1.Northwind.dbo appears beneath the Data Connections node.

To remove a data connection from Server Explorer/Database Explorer

  1. In Server Explorer, expand the Data Connections node.

  2. Select the desired database connection.

  3. Press the DELETE key.

    There is no effect on the actual database. You are removing the reference from your view.

See Also

Concepts

Displaying Data Overview

Other Resources

Data Walkthroughs

Getting Started with Data Access

Connecting to Data in Visual Studio

Preparing Your Application to Receive Data

Fetching Data into Your Application

Displaying Data on Forms in Windows Applications

Editing Data in Your Application

Validating Data

Saving Data