Share via


How to: Connect to a Database

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Standard

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Pro and Team

Topic applies Topic applies Topic applies Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

This section describes how to set up a database connection in Microsoft Visual Studio 2005.

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

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, right-click Data Connections, and click Add Connection.

  3. In the Choose Data Source dialog box, click 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. Click the Continue button.

    The Add Connection dialog box appears.

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

  6. In the Log on to the server pane, type the user name and password to access the server or select Use Windows NT Integrated Security, depending on your type of security and credentials.

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

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

  9. Click OK.

See Also

Other Resources

Debugging SQL Database Objects

Setting Up SQL Debugging