Truncated incorrect DOUBLE value?

Asked

Viewed 64 times

0

Guys I have this UPDATE code to do, where it adds the previous value of the column (valor_abertura) with one who comes from UPDATE, but he gives the error:

Truncated incorrect DOUBLE value. 

the values are in decimal in the MySQL and in the C#.

commad.CommandText = "UPDATE pdv_historico SET sangria = @sangria , 
valor_abertura = @valor_abertura + '" + reforco +"' 
ORDER BY idpdv_historico DESC LIMIT 1";

commad.Parameters.AddWithValue("sangria", sangria);                                    
commad.Parameters.AddWithValue("valor_abertura", reforco); 

1 answer

1


Change commad.Commandtext to UPDATE pdv_historico SET sangria = @sangria , valor_abertura = @valor_abertura ORDER BY idpdv_historico DESC LIMIT 1, Once sangria and opening value are added as parameters.

If you want to adicionar the value of reforco to the value that is in valor_abertura in the database should be UPDATE pdv_historico SET sangria = @sangria , valor_abertura = valor_abertura + @valor_abertura ORDER BY idpdv_historico DESC LIMIT 1.

  • Opa very compelling, it worked now tvdias.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.