ConnectionStringSettings 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 ConnectionStringSettings 類別的新執行個體。
多載
ConnectionStringSettings() |
初始化 ConnectionStringSettings 類別的新執行個體。 |
ConnectionStringSettings(String, String) |
初始化 ConnectionStringSettings 類別的新執行個體。 |
ConnectionStringSettings(String, String, String) |
初始化 ConnectionStringSettings 類別的新執行個體。 |
ConnectionStringSettings()
初始化 ConnectionStringSettings 類別的新執行個體。
public:
ConnectionStringSettings();
public ConnectionStringSettings ();
Public Sub New ()
另請參閱
適用於
ConnectionStringSettings(String, String)
初始化 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)
初始化 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"))