How to insert a double value on mysql database?

  • Thread starter Thread starter PedroFilipe
  • Start date Start date
P

PedroFilipe

Guest
I want to insert a value from a numericUpDown with decimal values like "2,25" but sql doesn't use commas as decimal devider, so it inserts "2" instead of "2,25"

How can I format the numericUpDown or some other thing that helps me?


edit:

var bdCon = Conexao.Instance();
bdCon.DatabaseName = "solintep";
if (bdCon.IsConnect())
{
string query = $"INSERT INTO libelles (rubrica, data, libelle, assunto, numero, user_id) VALUES ('{cbRubrica.Text}', '{dpData.Value.ToString("yyyy/MM/dd")}', '{txtLibelle.Text}', '{cbAssunto.Text}', '{nrNumero.Value}', '{userId}');";
var cmd = new MySqlCommand(query, bdCon.Connection);
cmd.ExecuteNonQuery();
}
bdCon.Close();

Continue reading...
 

Similar threads

Back
Top