ConnectionStringsExpressionBuilder.GetConnectionString(String) 方法
定义
从 Web.config 文件的 <connectionStrings> 节返回一个连接字符串。Returns a connection string from the <connectionStrings> section of the Web.config file.
public:
static System::String ^ GetConnectionString(System::String ^ connectionStringName);
public static string GetConnectionString (string connectionStringName);
static member GetConnectionString : string -> string
Public Shared Function GetConnectionString (connectionStringName As String) As String
参数
- connectionStringName
- String
连接字符串的名称。The name of the connection string.
返回
此连接字符串名称对应的连接字符串,类型为 String。The connection string as a String for this connection string name.
例外
未能在 Web.config 文件中找到连接字符串名称。The connection string name could not be found in the Web.config file.
注解
ConnectionStrings属性返回连接字符串值的集合。The ConnectionStrings property returns a collection of connection string values. GetConnectionString方法返回此集合中与连接字符串名称关联的值。The GetConnectionString method returns the value from this collection that is associated with the connection string name.