update with double condition in c #

0

I need to update a field of a record in my sql database using two conditions

I'm trying to do it in the following way

sql = "UPDATE detalle_pedido SET cant_ingresar = '" + Convert.ToDecimal(TextBoxCantidadCargar.Text.Trim()) + "' where codigobarras = '" + codigo + "' AND idpedido='" + idpedido + "'";

but I did not manage to do the update.

What should I modify to do so?

    
asked by Andrex_11 30.10.2018 в 20:42
source

1 answer

2

1.- Transforms the variable, outside the update, so you verify that you have the correct data type.

2.- You may have some problem with the use of '', I suggest you use a breakpoint of visual studio and verify the values of the variables and see how the query is, by consulting the value of the variable "sql ".

    
answered by 30.10.2018 / 22:24
source