Quote:
cmd3.CommandText = "insert into sales-product(sales-id, product-name, qty, price, gross-total)values(@sales-id, @product-name, @qty, @price, @gross-total)";
...
cmd4.CommandText = "insert into sales(id, date, time, qty, gross-total)values(@id, @date, @time, @qty, @gross-total)";
Unquoted table, column, and parameter names may not contain a minus sign (
-
). They can only contain letters, numbers, underscores (
_
), or the dollar sign (
$
).
MySQL :: MySQL 8.0 Reference Manual :: 9.2 Schema Object Names[
^]
If at all possible, you should rename your columns to follow these rules. If not, you will need to quote them in any query.
cmd3.CommandText = "insert into `sales-product` (`sales-id`, `product-name`, qty, price, `gross-total`) values (@SalesId, @ProductName, @qty, @price, @GrossTotal)";
...
cmd4.CommandText = "insert into sales (id, date, time, qty, `gross-total`) values (@id, @date, @time, @qty, @GrossTotal)";