ConnectionStringSettings 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 ConnectionStringSettings 类的新实例。
重载
ConnectionStringSettings()
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
初始化 ConnectionStringSettings 类的新实例。
public:
ConnectionStringSettings();
public ConnectionStringSettings ();
Public Sub New ()
另请参阅
适用于
ConnectionStringSettings(String, String)
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
初始化 ConnectionStringSettings 类的新实例。
public:
ConnectionStringSettings(System::String ^ name, System::String ^ connectionString);
public ConnectionStringSettings (string name, string connectionString);
new System.Configuration.ConnectionStringSettings : string * string -> System.Configuration.ConnectionStringSettings
Public Sub New (name As String, connectionString As String)
参数
- name
- String
连接字符串的名称。
- connectionString
- String
连接字符串。
另请参阅
适用于
ConnectionStringSettings(String, String, String)
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
- Source:
- ConnectionStringSettings.cs
初始化 ConnectionStringSettings 类的新实例。
public:
ConnectionStringSettings(System::String ^ name, System::String ^ connectionString, System::String ^ providerName);
public ConnectionStringSettings (string name, string connectionString, string providerName);
new System.Configuration.ConnectionStringSettings : string * string * string -> System.Configuration.ConnectionStringSettings
Public Sub New (name As String, connectionString As String, providerName As String)
参数
- name
- String
连接字符串的名称。
- connectionString
- String
连接字符串。
- providerName
- String
与连接字符串一起使用的提供程序的名称。
示例
以下示例演示如何创建 ConnectionStringSettings 对象并将其添加到 ConnectionStringSettingsCollection 集合。
// Add the connection string.
ConnectionStringsSection csSection =
config.ConnectionStrings;
csSection.ConnectionStrings.Add(
new ConnectionStringSettings(csName,
"LocalSqlServer: data source=127.0.0.1;Integrated Security=SSPI;" +
"Initial Catalog=aspnetdb", "System.Data.SqlClient"));
' Add the connection string.
Dim csSection _
As ConnectionStringsSection = _
config.ConnectionStrings
csSection.ConnectionStrings.Add( _
New ConnectionStringSettings(csName, _
"LocalSqlServer: data source=127.0.0.1;Integrated Security=SSPI;" _
+ "Initial Catalog=aspnetdb", "System.Data.SqlClient"))