Read empty values โโas empty, not as default
How to read empty values โโfrom a "dbf" file in C #. Currently, when reading dbf files, empty values โโin the file are automatically converted to default values. How an empty decimal field is converted to "0.000". Someone can help to read empty fields as they are and not as default values.
a source to share
Can you declare your variables (at least value types) as nullable types :
decimal? myDecimal = null;
Then, if there is no value in the field, it should be left null and not set to default.
Syntax T? is shorthand for Nullable, where T is the value type. These two forms are interchangeable.
a source to share
decimal
is the so called value type and it cannot be null, which is probably the reason you get these defaults. However, most databases have the concept of null values โโ( DbNull
), so most likely it's just a matter of reading the value correctly.If you post the code, we can help you.
a source to share