none
ADO.NET, Dataset, some decimal value are saved as 0 in Access Database RRS feed

  • General discussion

  • Hello

    I use an TypedDataset with an Access Database (.mdb file) in an application.

    One of the table in the Database contains a decimal (18,4) Column.

    When I try to update the database form the dataset, using the tableAdapter. Some values are written to the database to 0 !

    It's not a zeroing issue because one this value is 11.499153114408180514070679688 (which should be saved as 11.4991). It's not a query error as the value is really set to 0 and the other fields are updating correctly. No exception are throw during the update process.

    If I make an update on 30 rows, I could have 10 rows updated as 0 and 20 rows updated correctly. The rows in error will always be the same if I do the updating process multiple time.

    If I add a round operation to four decimal on my datarow before updating to the database, all is working fine. If I execute an hand-made string query with the same value it's working fine too.

    I suppose that this issue is related to the paramater type used by the tableadapter for decimal value. I have tried to change my column to double in the dataset and the value are updating correctly.

    I have found enough workarounds for resolving this issue by writing this post (round value before update, use double instead of decimal (in access and in dataset), don't use access with ADO.NET TypedDataset as this bug is only a new entry in a long list...).

    I hope that I will save some hour to someone. If anybody have some information do not hesitate.

    Thursday, July 16, 2015 9:35 AM

All replies