locked
Changed from server now decimal places and data format are different RRS feed

  • Question

  • User-909867351 posted

    Hi

    I need to change my website to another server. My application was programmed with the decimal point "." as decimal separator and date format yyy-mm-dd 

    Now on my new server the decimal point is the "," symbol. I have a lot of math calculation and now I have to change my all code (because the decimal separator changed)? 

    Thank you

    Thursday, May 31, 2018 5:45 PM

Answers

  • User753101303 posted

    How does it fail exactly ? What is the current culture ?

    If the same culture is used when converting a decimal to a string and then this string to a decimal it should work.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 1, 2018 7:15 PM

All replies

  • User283571144 posted

    Hi mariolopes,

    As far as I know, we could set the decimal point on that server by modify the region setting in control panel.

    We coud locate the Control panel ---> Region ---> Additional Settings to modify the decimal symbol and the date.

    I suggest you could contack with your server administrator to modify the regon setting.

    More details, you could refer to below article:

    https://docs.microsoft.com/en-us/globalization/locale/number-formatting 

    Best Regards,

    Brando

    Friday, June 1, 2018 6:35 AM
  • User753101303 posted

    Hi,

    It seems in a change in the default culture in use. Try https://msdn.microsoft.com/en-us/library/bz9tc508.aspx to force the culture you want to use for your site.

    Or you were using "auto" and your browser culture changed?

    Friday, June 1, 2018 6:59 AM
  • User-909867351 posted

    The admin can change the  region setting because it will alter all the others mysql files

    The culture doesn't seems to work. I have to insert data in Mysql databases and I got errors In code like this one

    OdbcConnection connection = new OdbcConnection("Dsn=programa_explicame;server=localhost;uid=xxx;pwd=xxx;database=programa_explicame;port=3306");
                        OdbcCommand command = new OdbcCommand("INSERT INTO aulas SET id_aluno =?,nome_aluno =?,codigo_atividade =?,atividade =?,debitar =?,data=?,hora_inicio =?,hora_fim =?,professor =?,id_professor =?,valor_pago =?,a_receber =?,qta =?", connection);
                        command.Parameters.AddWithValue("@id_aluno", System.Convert.ToInt16(id_aluno.Value));
                        command.Parameters.AddWithValue("@nome_aluno", lblNome.Text);
                        command.Parameters.AddWithValue("@cod_atividade", ListBox1.SelectedValue);
                        command.Parameters.AddWithValue("@atividade", ListBox1.SelectedItem.ToString());
                        command.Parameters.AddWithValue("@debitar", System.Convert.ToInt16(descontar.Value));
    
                        command.Parameters.AddWithValue("@data11", System.Convert.ToDateTime(data_txt.Text));
                        command.Parameters.AddWithValue("@hora_inicio", inicio_txt.Text);
                        command.Parameters.AddWithValue("@hora_fim", fim_txt.Text);
                        command.Parameters.AddWithValue("@professor", Session["nome"]);
    
                        command.Parameters.AddWithValue("@idprofessor", System.Convert.ToInt16(Session["id"]));
                        command.Parameters.AddWithValue("@valor_pago", System.Convert.ToDecimal(valor_Pago.Value));
                        command.Parameters.AddWithValue("@valor_receber", Math.Round(System.Convert.ToDecimal(ganhaprof),1));
    
                        command.Parameters.AddWithValue("@qta", System.Convert.ToInt16(desconto));
    
                        connection.Open();
                        command.ExecuteNonQuery();
                        connection.Close();

    I think I have to redo all the work

    Friday, June 1, 2018 6:35 PM
  • User753101303 posted

    How does it fail exactly ? What is the current culture ?

    If the same culture is used when converting a decimal to a string and then this string to a decimal it should work.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 1, 2018 7:15 PM