0
I am not able to insert double variables when they are greater than 1,000.00 because of the comma that Apare and so sql recognizes that I am trying to insert two data, I tried to use the replace(",",".") method, but it did not work.
if (txtDesconto.Text == string.Empty)
{
preco = preco - 0;
}
else
{
preco -= desconto;
}
string precoStr = preco.ToString("N", CultureInfo.CreateSpecificCulture("en-US"));
precoStr.Replace(",", "");
Conexao conexao = new Conexao();
var escolha = MessageBox.Show("O cliente efetuou o pagamento de " + preco.ToString("c") + " ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (escolha == DialogResult.Yes)
{
conexao.conectar();
int insere = conexao.executar($"INSERT INTO Vendas(data, carro, placa, idCliente, pago, formaPagamento, valorCobrado) VALUES('{dataAmericanFormat}','{venda.carro}','{venda.placa}','{venda.idCliente}', 1, '{venda.formaPagamento}', {precoStr}) ");
conexao.desconectar();
}
Okay, it makes a lot of sense what Oce said and it would certainly work, but doing it would give some interference in the data that are already saved?
– Matheus Lima Fraga