ConnectionStringsExpressionBuilder.GetConnectionString Method (String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns a connection string from the <connectionStrings> section of the Web.config file.

Namespace:   System.Web.Compilation
Assembly:  System.Web (in System.Web.dll)

public static string GetConnectionString(
	string connectionStringName
)

Parameters

connectionStringName
Type: System.String

The name of the connection string.

Return Value

Type: System.String

The connection string as a String for this connection string name.

Exception Condition
InvalidOperationException

The connection string name could not be found in the Web.config file.

The ConnectionStrings property returns a collection of connection string values. The GetConnectionString method returns the value from this collection that is associated with the connection string name.

.NET Framework
Available since 2.0
Return to top
Show: