0

Here's an example scenario using VB.Net and MS Access (ADO.NET):

  1. The current thread's language setting is fr-FR with thousand separator of a space and decimal separator of a comma.

  2. I have a string amount of 33 233,25

  3. I convert it to a decimal which I know doesn't have any built-in regionalization formatting, so it shows in the debugger as 33233.25 since I'm in the US.

  4. All is well until I try to save this number into an Access database table with a data type of Number (decimal). When I try to save I get an error message telling me that there's a data type mismatch in criteria expression.

I know the decimal is the problem because when I replace it with a literal of 10,50, the record update is fine. I'm confused as I thought the decimal had no inherent language properties.

What am I missing?

Thanks

user1615597
  • 33
  • 1
  • 4
  • How are you trying to save the number into the table? – grahamj42 Mar 21 '13 at 20:55
  • Are you trying to save a decimal into a string column? – George Mar 21 '13 at 20:58
  • Seems odd to me, there are some notes here http://stackoverflow.com/questions/11565335/ms-access-database-with-number-fields-in-a-foreign-language/11565461#11565461 – Fionnuala Mar 21 '13 at 21:20
  • I'm using an SQL statement with parameters - so I'm just adding the decimal number as a parameter and then executing a nonquery to add the table record. – user1615597 Mar 21 '13 at 22:45
  • Just some additional information - it seems to be a problem with the decimal data type in VB.Net (not in the Access database). If I take the same string and convert it to a double instead of a decimal, it's fine. If anyone has any reasons for this, please post. – user1615597 Mar 21 '13 at 23:34

0 Answers0