0
I am developing a C# application and I use a BD in Mysql. In a part of the system, I need to increase the stock of a certain product, test the command in Workbench and worked well, but when I run this command inside the visual studio returns me error. Follows the code
// Abre a conexão
mConn.Open();
//Query SQL
MySqlCommand command2 = new MySqlCommand("UPDATE estoque SET quantidade_estoque = quantidade_estoque + $'"+ txtQuantidade.Text +"' WHERE produto_estoque = '"+ cmbbProduto.Text +"')", mConn);
//Executa a Query SQL
command2.ExecuteNonQuery();
// Fecha a conexão
mConn.Close();
And the mistake is this:
Mysql.Data.Mysqlclient.Mysqlexception: 'You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near ''500' WHERE product_stock = 'Product')' at line 1'
Any idea what it might be?
checked the data types?
produto_estoque
can be an id and is passing a text..– rLinhares