public void InserirItemVenda(ItemVenda i) { this.Conect(); sql = "INSERT INTO tbitemvenda(idproduto, qtditens, totalpreco, prcvenda, idvenda)"; sql = sql + "VALUES(@idproduto, @qtditens, @totalpreco, @prcvenda, @idvenda); "; cmd = new NpgsqlCommand(sql, con); cmd.Parameters.AddWithValue("idproduto", i.getIdProduto()); cmd.Parameters.AddWithValue("qtditens", i.getQtdItens()); cmd.Parameters.AddWithValue("totalpreco", i.getTotalPreco()); cmd.Parameters.AddWithValue("prcvenda", i.GetPrcVenda()); cmd.Parameters.AddWithValue("idvenda", i.getIdDocumento()); cmd.Prepare(); cmd.ExecuteNonQuery(); this.Desconect(); }