Select to view content in your preferred language

Feature.SetAttributeValue() And Then UpdateFeatureAsync(Feature feature)

1148
1
06-09-2017 12:52 AM
xiaoguangyan
New Contributor III

I got a exception "Internal error exception: *** has an incorrect value. Encountered on feature with ID of 4768"., when I use Feature.SetAttributeValue( "***", 2) And Then UpdateFeatureAsync(Feature feature), The Attribute I want to set is type of integer.

Tags (1)
0 Kudos
1 Reply
NagmaYasmin
Esri Contributor

Hi Yan,

I happened to experience similar error while updating the attribute data of the field type "short" or "Int16" of a feature table to an integer like 2. 

Numbers such as 2, 3 etc. are interpreted by the .NET compiler as type 'int' or 'Int32', so there is a mismatch of the field type. In this case the values must be explicitly declared as type 'short' or 'Int16'.

For your case, you may write the code as below:

Feature.SetAttributeValue( "***", (short)2);

Hope that helps.

Nagma

0 Kudos