This documentation is archived and is not being maintained.

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 =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);

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

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



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
Show: