Page 1 of 1

sql query error -Incorrect syntax near WHERE

Posted: Fri May 11, 2012 7:00 am
by omayer
what am i missing here -trying to insert data in existing row

cmdScnDesc = new SqlCommand("INSERT INTO PlacementRunResults(ScenarioDescr) VALUES (@_scenarioDescr) WHERE scenarioid LIKE @_scenarioid",dbConnection._conn);
Thank you in Advance
Beginner

Re: sql query error -Incorrect syntax near WHERE

Posted: Fri May 11, 2012 8:31 am
by artur_gadomski
You need update statement. I think it should look like that, but you may want to google it to make sure the correct syntax.

Code: Select all

UPDATE TABLE PlacementRunResults
SET ScenarioDescr = @_scenarioDescr
WHERE scenarioid LIKE @_scenarioid

Re: sql query error -Incorrect syntax near WHERE

Posted: Fri May 11, 2012 4:40 pm
by omayer
It works, Thank you so much for your help :D