共用方式為


SqlProfileProvider.SetPropertyValues 方法

定義

使用指定的屬性值更新 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)

參數

sc
SettingsContext

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 配置檔案屬性資訊和值會指定為 物件的集合。

適用於

另請參閱