SetAttrValue(String,Object,String,String,String,String,String,Boolean) Method
- Last UpdatedNov 06, 2025
- 2 minute read
The SetAttrValue() method adds an attribute or updates the value of an existing attribute. A flag indicates whether the value is being added or updated. The method includes a lastEdit DateTime parameter that can be used for optimistic concurrency control. This overload of the method uses the attribute name and one filter item to specify the attribute.
public static bool SetAttrValue(
string attrName,
object attrVal,
string lastEdit,
string modId,
string tableName,
string filterField,
string filterValue,
bool bAdd
)
Parameters
- attrName
- Required. Holds the name of the attribute whose value is being added or updated.
- attrVal
- Required. Holds the attribute value.
- lastEdit
- Required. Holds a DateTime value to avoid data contention. The passed value must match the lastEdit value in the database for the update to succeed.
- modId
- Required. Holds the mod ID.
- tableName
- Required. Holds the attribute table name to be read; for example, "item_attr" for item attributes.
- filterField
- Required. Holds the filter field to be used, for example "item_id".
- filterValue
- Required. Holds the filter value associated with the filter field.
- bAdd
- Required. Holds a flag that, if set to true, indicates that the attribute is being added. If the flag is set to false, it indicates that the attribute is being updated.
Return Value
Returns true if setting the attribute value succeeds and false if setting
the attribute value fails.