2014-10-07 23 views
0

我有一個表在LightSwitch的,而我已經添加了一個名爲計算列「全名」。在該字段的方法..我寫了 FullName = this.EmployeeFirstName +「」+ this.EmployeeMiddleName +「」+ this.EmployeeLastName;不能賦值到計算列在Lighswitch

但C#是給我的錯誤「屬性或索引不能被分配到 - 它是隻讀」

任何人都可以請幫我這一個? 在此先感謝

+0

任何幫助請傢伙 – user1552698 2014-10-08 06:29:06

回答

1

要設置計算屬性的值,請設置傳遞給FullName_Compute方法的「result」參數的值。

partial void FullName_Compute(ref string result) 
{ 
    result = this.EmployeeFirstName + " " + this.EmployeeMiddleName + " " + this.EmployeeLastName; 
} 

How to: Add a Computed Field in a LightSwitch Database