I have the following problem in my code, I have a textbox
that receives the value 0.900
, but when I am writing this value to the bank, it is only recording 900, and I need to record the 0.900 and I can not write this way, the field in the sql
table is as float
. I'm trying to do float.Parse(txt_qtda.Text)
and it's not working, just write 900
and not 0.900
.
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO CB0020 (CB0_FILIAL, CB0_CODETI, CB0_DTNASC, CB0_TIPO, CB0_CODPRO, CB0_QTDE, CB0_LOCAL, CB0_LOTE, CB0_DTVLD, CB0_FORNEC, CB0_LOJAFO, CB0_XLOTEF, CB0_XQTDKG, CB0_XORIGE, CB0_XDTFAB, CB0020.R_E_C_N_O_) VALUES ('01','" + txt_codbarras.Text + "', '" + txt_dtnasc.Text + "', '01', '" + txt_codprod.Text + "', '" + float.Parse(txt_qtda.Text) + "', '01', '" + txt_lotefrac.Text + "', '" + Convert.ToDateTime(txt_dtvalidfrac.Text).ToString("yyyy/MM/dd").Replace("/", "") + "', '" + txt_codfbaric.Text + "', '01', '" + txt_lotefabric.Text + "', '" + float.Parse(txt_qtda.Text) + "', '" + txt_codorig.Text + "', '" + Convert.ToDateTime(txt_dtfabricfrac.Text).ToString("yyyy/MM/dd").Replace("/", "") + "', '" + txt_recno.Text + "')";
cmd.Connection = conex;
conex.Open();
cmd.ExecuteNonQuery();