[Solved] Unable to insert mutiple values to database [closed]


You can’t do 2 sets of values like your trying to do with an INSERT statement. Your effectively doing:

INSERT INTO Controller_Forecast(C1,C2...)
VALUES(...loads of values...)
VALUES(...Loads of more values...)

This isn’t valid. To insert 2 sets of data, which is what it looks like you’re trying to do you can do 2 INSERT INTO statements or split the list of values with commas like so:

Multiple insert statements

INSERT INTO Controller_Forecast(C1,C2...)
VALUES(...your first set of values...)
INSERT INTO Controller_Forecast(C1,C2...)
VALUES(...your second set of values...)

Separating with commas

INSERT INTO Controller_Forecast(C1,C2...)
VALUES(...your first set of values...), (...second set of values...)

However, this seems inefficient and you’d be better off writing this in a store procedure and parameterising your values to avoid sql injection.

solved Unable to insert mutiple values to database [closed]