I keep getting the same vague error with this code:
command.CommandText = "INSERT INTO database (upc, title, description, quantity) VALUES ('"+ upc.Text +"',"+"'"+titlename+"',"+ "'"+descname+"',"+ "'1'"+"), MyConString";
The error is:
{“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 ‘database (upc, title, description, quantity) VALUES
(‘016000165779′,’Betty Crock’ at line 1”}
I’m new at C# and trying to build a program that uses UPC codes that get inserted into a mySQL database.
Try this:
Notes:
upc.Text, that makes me think that your concatenating user input into your SQL string (very dangerous).