title: c# mysql decimal numbers with . or ,
body: <p>I have a table EXPENSES in a mysql database and one of the columns is AMMOUNT with decimal(10,2) as type. I have an application in C# (winforms) with a textbox that is used to insert values in the database. </p>
  
  <pre><code>string initialquery = "INSERT INTO EXPENSES (ID, E_DATE, AMMOUNT, PERSON, COMMENTS, T_ID) " +
                              "VALUES ('" + id + "', '" + date.ToString("yyyy:MM:dd") + "', '" + ammount + "', '" + person + "', '" + comments + "', '" + tid + "')";
          //yyyy:MM:dd hh:mm:ss
          myMySqlConnection.Open();
          MySqlCommand command1 = new MySqlCommand(initialquery, myMySqlConnection);
          command1.ExecuteNonQuery();
          if (lang == 2)
              MessageBox.Show("ΤΑ ΔΕΔΟΜΕΝΑ ΑΠΟΘΗΚΕΥΤΗΚΑΝ");
          else if (lang == 1)
              MessageBox.Show("DATA SAVED");
          myMySqlConnection.Close();
  </code></pre>
  
  <p>The problem has to do with the regional settings. If i set the format to GREEK. The decimal symbol is ",". When i try to insert a decimal value with a "," it doesn't accept it (is stored as 405 instead of 40,5). If i set the decimal symbol to"." and i have in the textbox 40.5 is stored correctly. If i set the Regional settings to ENGLISH and i set the decimal value to "," again is not working. Seems like that decimal numbers are accepted only when the decimal symbol is a "." I don't quite understand this. How can i make it accept the "," as a decimal operator?</p>
  
  <p>Best Regards
  George Georgiou</p>