SqlProfileProvider.SetPropertyValues 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用指定的屬性值更新 SQL Server 設定檔資料庫。
public:
override void SetPropertyValues(System::Configuration::SettingsContext ^ sc, System::Configuration::SettingsPropertyValueCollection ^ properties);
public override void SetPropertyValues (System.Configuration.SettingsContext sc, System.Configuration.SettingsPropertyValueCollection properties);
override this.SetPropertyValues : System.Configuration.SettingsContext * System.Configuration.SettingsPropertyValueCollection -> unit
Public Overrides Sub SetPropertyValues (sc As SettingsContext, properties As SettingsPropertyValueCollection)
參數
SettingsContext,包含使用者設定檔資訊。
- properties
- SettingsPropertyValueCollection
SettingsPropertyValueCollection,包含要更新的屬性之設定檔資訊和值。
範例
下列程式碼範例會 SetPropertyValues 使用 方法來修改配置檔案屬性值。
SqlProfileProvider p =
(SqlProfileProvider)Profile.Providers["SqlProvider"];
SettingsPropertyValueCollection pvalues =
p.GetPropertyValues(Profile.Context, ProfileBase.Properties);
pvalues["ZipCode"].PropertyValue = "98052";
pvalues["CityAndState"].PropertyValue = "Redmond, WA";
p.SetPropertyValues(Profile.Context, pvalues);
Dim p As SqlProfileProvider = _
CType(Profile.Providers("SqlProvider"), SqlProfileProvider)
Dim pvalues As SettingsPropertyValueCollection = _
p.GetPropertyValues(Profile.Context, ProfileBase.Properties)
pvalues("ZipCode").PropertyValue = "98052"
pvalues("CityAndState").PropertyValue = "Redmond, WA"
p.SetPropertyValues(Profile.Context, pvalues)
備註
當 SetPropertyValues 為目前要求設定屬性值時,ASP.NET 設定檔服務會使用 方法來更新SQL Server設定檔資料庫。 屬性值是在組態檔中 屬性所 applicationName
指定之應用程式的資料來源上設定。 要由 更新的 SqlProfileProviderSettingsPropertyValue 配置檔案屬性資訊和值會指定為 物件的集合。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應