tornic
tornic

Reputation: 745

Trying to save null value with arcObjects

I'm trying to save a null in an integer column with arcObjects but it always save 0 when the value is null. Can anyone explain me what is happening? I am developing in C#.

I tried to assign DBNull.Value to my variable but I can't because it's an integer. Thank you very much for your time and your knowledge!

Visual Studio side:

enter image description here

Visual Studio Side

ArcGIS side:

ArcGis Side

Upvotes: 0

Views: 773

Answers (3)

N Iranshahi
N Iranshahi

Reputation: 21

Shapefile does not support Null in field value and converts it to default value ie 0 for integer types. In a Geodatabase, the field "Allow NULL values" property should be set to "Yes".

Upvotes: 0

Diego Peinador
Diego Peinador

Reputation: 81

U need DBNull

... = (entry.Value == null) ? DBNull.Value : entry.Value;

Upvotes: 2

tornic
tornic

Reputation: 745

Solved!!

Setting DBNull in this point the problem dissapear:

enter image description here

Upvotes: 1

Related Questions