Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Update Database Problem
Yvonne_Armstrong_(yarmstrong_-_(deleted))
I hope someone can help as I'm going slightly mad!I have a script extension which is meant to update a SQL Server 2005 table with a load of form data. There are no errors and if I 'write' the SQL to the page and copy it into SQL Server, it works perfectly. If I just run it from the web page it does absolutely nothing!I have copied the script from one which updates another table in the same database and just replaced the variables.I have copied the database connect and execute commands from the delete script (which also works!).Attached are:update_event_action.txt - the script which doesn't work.EventUpdateSQL.txt - The outputted SQL command.update_planner.txt - the update script which works on the same database but different table.delete_event_action.txt - delete script for the same table which does work.Please help! Yvonne
Find more posts tagged with
Comments
Appu_Nair
I just have one simple suggestion to rule out if it has something to do with javascript concatenation,escapes etc that may not appear formatted to SQLserver.When you run it thru sql studio it probably corrects istelf.What I would do is to hardcode a simple update statement in your update_event_action and if that works then you know that it is something in that huge string that you are building.You also then know that this particular table can take an update.I am thinking of a vague possibility where this db connection user does not have DDL rights on that table.BTW:It would really be better if you can use javascript to properly format the SQLcommand using bind variables etc .I don't know how you could do it but in oscript we always put bind vars so it is less prone to sql injection and stuff like that
Yvonne_Armstrong_(yarmstrong_-_(deleted))
Many thanks for the helpful suggestion. I hard coded the resolved SQL into my script and that didn't work either. I noticed that I had double spaces in my dates and once I took them out it worked.Unfortunately the original SQL string with the variables still doesn't work but I will add the variables in one at a time and hopefully track down the problem.ThanksYvonne