Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Accessing Data
 How to: Edit a Connection String

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Data Access in Client and Middle-Tier Programming
How to: Edit a Connection String

Connection strings stored in an application are either saved in the application configuration file (application settings) or compiled in the code (typically as the ConnectionString property of a connection object). Data connections created with the Data Source Configuration Wizard give you the option to store connection strings in the applications settings file, or to hard-code them in the dataset definition.

You can modify connection information that is saved in application settings by using the Project Designer.

To edit a connection string stored in application settings

  1. In Solution Explorer, double-click the My Project icon (Visual Basic) or Properties icon (Visual C# or Visual J#) to open the Project Designer.

  2. Select the Settings tab.

  3. Locate the connection you want to edit and select the text in the Value box.

  4. Edit the connection string in the Value box.

    -or-

    Click the ellipses in the Value box to edit your connection with the Connection Properties dialog box. For more information, see Add/Modify Connection Dialog Box (General).

You can modify connection information that is saved in code by using the Dataset Designer.

To edit a connection string stored in code

  1. In Solution Explorer, double-click the dataset (.xsd file) with the connection you want to edit.

  2. Select the TableAdapter or query with the connection you want to edit.

  3. In the Properties window expand the DefaultConnection node.

  4. To quickly modify the connection string, edit the ConnectionString property.

    -or-

    Click the down arrow on the DefaultConnection property and choose New Connection to open the Add/Modify Connection Dialog Box (General).

Storing sensitive information (such as a password) can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see Protecting Connection Information (ADO.NET).

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker