I'm developing a C # application and I use a BD in MySql. In a part of the system, I need to increment the inventory of a particular product, test the command in the Workbench and it worked fine, but when I execute this command inside visual studio it returns error. Follow 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 error is as follows:
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 producto_estoque = 'Product') 'at line 1'
Any idea what it might be?