SqlDataSource.OldValuesParameterFormatString 屬性

定義

取得或設定格式字串,套用至傳遞給 Delete()Update() 方法之任何參數的名稱。

public:
 property System::String ^ OldValuesParameterFormatString { System::String ^ get(); void set(System::String ^ value); };
public string OldValuesParameterFormatString { get; set; }
member this.OldValuesParameterFormatString : string with get, set
Public Property OldValuesParameterFormatString As String

屬性值

字串,表示套用至傳遞給 Delete()Update() 方法之任何 oldValues 參數名稱的格式字串。 預設值為「{0}」。

備註

格式 OldValuesParameterFormatString 字串只會套用至主鍵,例如由 DataKeyNames 相關聯資料系結控制項的 屬性所識別,或在將 屬性設定為 CompareAllValues 值且將 的集合 oldValues 傳遞給對應資料方法的刪除和更新案例 ConflictDetection 中。 在此情況下,格式字串會套用至集合中的每個 oldValues 參數名稱。

您可能會變更 OldValuesParameterFormatString 屬性的兩個常見案例如下:

  • 區分更新中的舊值和新值。 當 屬性 ConflictDetection 設定為 CompareAllValues 值時,原始值和新值的參數都會新增至 UpdateParameters 集合。 如果沒有格式化字串,系統會為每個資料欄位建立兩個具有相同名稱的參數。 藉由變更原始值參數的名稱,您可以將資料與原始資料來源進行比較,以偵測衝突並比較索引鍵值。

  • 某些視覺化設計工具會實作原始值和索引鍵的特定命名配置。

適用於

另請參閱