How to: Connect to a Database with Server Explorer

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional

Visual Studio Express

ms165037.DoesApplybmp(en-us,VS.100).gif ms165037.DoesApplybmp(en-us,VS.100).gif ms165037.DoesApplybmp(en-us,VS.100).gif ms165037.DoesNotApplybmp(en-us,VS.100).gif

This section describes how to set up a database connection with Server Explorer in Visual Studio when debugging Transact-SQL with SQL Server 2005, or later.

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 set up a database connection in Server Explorer

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, right-click Data Connections, and click Add Connection. This opens the Add Connection dialog box.

  3. In the Data Source dialog box, click Change to specify the data source. In the Change Data Source dialog box, select Microsoft SQL Server from the Data source list and ensure that the Data provider list is set to .NET Framework Data Provider for SQL Server.

  4. In the Server name box, select or type the name and instance of the SQL Server computer to connect to, in the form computer name\instance name. To connect to the default instance, only type the computer name.

  5. In the Log on to the server pane, select Use Windows Authentication or Use SQL Server Authentication, depending on your type of security and credentials.

  6. In the Select or enter a database name box, select or type the name of the database.

  7. Click the Test Connection button to verify that the connection exists.

  8. Click OK.

See Also

Other Resources

Debugging Transact-SQL Database Objects

Setting Up Transact-SQL Debugging