I get an error with modifying database from C # [closed]

0

  

This is my code but I do not know if there will be any problem with the sentence I have made

 public void modificar(Int32 cantidad, String producto, String tipo_pedido, Double total)
    {
        conexion.operacion("UPDATE pedidos set  PRODUCTO=" + producto + "', TIPO_PEDIDO = '" + tipo_pedido + "', TOTAL=" + total+" WHERE CANTIDAD = " + cantidad);
    }

 private void btnModificar_Click(object sender, EventArgs e)
    {
        cPedidos pedido = new cPedidos();
        if (rdbDoimicilio.Checked == true)
        {
            rdbDoimicilio.Text = "Para llevar";
            String domicilio = rdbDoimicilio.Text;
            pedido.modificar(Convert.ToInt32(txtCantidad.Text), cmbOpciones.Text, domicilio, Convert.ToDouble(txtTotal.Text));
            MessageBox.Show("Se ha modificado");
        }
        else 
        {
            rdbLocal.Text = "Cosumo local";
            String llevar = rdbLocal.Text;
            pedido.modificar(Convert.ToInt32(txtCantidad.Text), cmbOpciones.Text, llevar, Convert.ToDouble(txtTotal.Text));
            MessageBox.Show("Se ha modificado");
        }
      }

    
asked by JOGUEL CB 04.10.2018 в 02:03
source

2 answers

1

In the third line you need to close the quote

conexion.operacion("UPDATE pedidos set  PRODUCTO=" + producto + "', TIPO_PEDIDO = '" + tipo_pedido + "', TOTAL=" + total+" WHERE CANTIDAD = " + cantidad + '"');
    
answered by 04.10.2018 / 02:46
source
0

I think you need to open the quotes in after

UPDATE pedidos set  PRODUCTO="
    
answered by 04.10.2018 в 03:32