1
I researched and applied what I saw, but is giving error:
MySqlConnection con = new MySqlConnection(banco.Conexao);
MySqlCommand comando = new MySqlCommand("sp_venda", con);
comando.CommandType = System.Data.CommandType.StoredProcedure;
comando.Parameters.Add("usuario", MySqlDbType.Int32).Value = banco.Usuario;
comando.Parameters.Add("dinheiro", MySqlDbType.Double).Value = banco.formataDinheiro(Venda.Dinheiro);
comando.Parameters.Add("debito", MySqlDbType.Double).Value = banco.formataDinheiro(Venda.Dinheiro);
comando.Parameters.Add("credito", MySqlDbType.Double).Value = banco.formataDinheiro(Venda.Dinheiro);
comando.Parameters.Add("voucher", MySqlDbType.Double).Value = banco.formataDinheiro(Venda.Dinheiro);
comando.Parameters.Add("desconto", MySqlDbType.Double).Value = banco.formataDinheiro(VendaBLL.somaDescontos().ToString());
comando.Parameters.Add("troco", MySqlDbType.Double).Value = banco.formataDinheiro(Venda.Troco);
MySqlParameter paramHorario = new MySqlParameter("horario", MySqlDbType.Time);
paramHorario.Direction = System.Data.ParameterDirection.Output;
comando.Parameters.Add(paramHorario);
con.Open();
comando.ExecuteNonQuery();
Venda.Horario = comando.Parameters["horario"].Value.ToString();
con.Close();
The error occurs on the following line:
comando.ExecuteNonQuery();
The connection opens normally. The error returned is: "Formatexception: Input string was not in an incorrect format." What am I doing wrong?
Edit
public static string formataDinheiro(string grana)
{
if (DetectaTipo(grana) == "null")
return "null";
return grana.Replace("R$ ", "").Replace(",", ".");
}
Could you please put your function here
banco.formataDinheiro()
?– Leonel Sanches da Silva
@Gypsy omorrisonmendez ready (:
– Latrova
I updated my answer.
– Leonel Sanches da Silva