Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ConnectionStrings Property
Collapse the table of content
Expand the table of content

ConnectionStringsSection.ConnectionStrings Property

Note: This property is new in the .NET Framework version 2.0.

Gets a ConnectionStringSettingsCollection collection of ConnectionStringSettings objects.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public ConnectionStringSettingsCollection ConnectionStrings { get; 
/** @property */
public ConnectionStringSettingsCollection get_ConnectionStrings ()

public function get ConnectionStrings () : ConnectionStringSettingsCollection

Property Value

A ConnectionStringSettingsCollection collection of ConnectionStringSettings objects.

The following example shows how to use the ConnectionStrings property of the ConnectionStringsSection object.

static void ShowConnectionStrings()
     // Get the application configuration file.
    System.Configuration.Configuration config =

    // Get the conectionStrings section.
    ConnectionStringsSection csSection =
    for (int i = 0; i < 
        ConfigurationManager.ConnectionStrings.Count; i++)
        ConnectionStringSettings cs = 
        Console.WriteLine("  Connection String: \"{0\"",

        Console.WriteLine("#{0", i);
        Console.WriteLine("  Name: {0", cs.Name);
        Console.WriteLine("  Provider Name: {0", 

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft