Share via


Add/Modify Connection (Microsoft SQL Server)

The Add Connection dialog box for Microsoft SQL Server allows you to specify settings, such as server name and passwords, for this connection. This dialog box is available in two ways:

  • By setting Data Source to Microsoft SQL Server in the Change Data Source dialog box.

  • By setting Data Source to <other> in the Change Data Source dialog box, and by setting Data provider to .NET Framework Data Provider for SQL Server.

To use a different provider, click the Change button and select a different data source or provider in the Change Data Source dialog box.

Note

In Visual Studio 2012, you can connect to a SQL Server database from either SQL Server Object Explorer or the Data Connections node in Server Explorer. SQL Server Object Explorer provides a view that is like SQL Server Management Studio. To open this explorer from the menu bar, choose View, SQL Server Object Explorer. For more information, see Connected Database Development.

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.

  • Data Source
    Shows the data source and provider chosen in the Data Source dialog box.

  • Change button
    Brings up the Change Data Source dialog box where you can change the data source or provider.

  • Server name
    Shows the name of the server for this connection. To choose a different server, select one from the drop-down list or type the server name into the text box.

    Note

    Local SQL Server Express instances are not listed in the listing of available data sources. To specify the local instance of SQL Server Express, enter .\sqlexpress in the text box.

  • Refresh button
    Updates the list of servers to include any that became available since you opened or refreshed the drop-down list.

  • Use Windows authentication
    Allows a network user to access the database for this connection without supplying a separate User ID or password because these are obtained from the Windows NT network security process.

  • Use SQL Server authentication
    Sets the logon requirements so you must enter a user name and password to open the connection from Server Explorer.

  • User name
    Provides a text box in which to enter a User ID. When you open this connection, the logon dialog box will require that you enter this User ID to access the database. The database administrator must first grant permission for you to access the database in order for the connection to succeed.

  • Password
    Provides a text box in which to enter a password. When you open this connection, the logon dialog box will require that you enter this password to access the database. The database administrator must first grant permission for you to access the database in order for the connection to succeed.

  • Save my password
    Saves and encrypts your password so that you do not need to enter a password each time you open the connection.

  • Select or enter a database name
    Shows the name of the database to connect to. To choose a new database, select one from the drop-down list or type the database name into the text box.

  • Attach a database file
    Shows the file name of the database to attach. For a new connection, type the database filename or click Browse to locate the database file.

  • Logical name
    Shows the name for this database connection. This name does not need to match the name of the database file itself.

  • Advanced button
    Displays the Advanced Properties dialog box, where you can specify or view settings for the connection. The content of this tab changes depending on which provider you selected in the Data Source dialog box.

  • Test connection button
    Tests the connection without closing the dialog box so you can make adjustments to the settings if the connection does not succeed.

  • OK button
    Commits the connection settings.

See Also

Tasks

How to: Connect to a Database from Server Explorer

Reference

Advanced Properties

Choose/Change Data Source Dialog Box

Add/Modify Connection (ODBC)

Add/Modify Connection (Oracle)

Add/Modify Connection (Microsoft Access)

Add/Modify Connection (OLE DB)

Add/Modify Connection (Microsoft SQL Server Database File)