The formatting of your post is a bit off. If it isn't code, don't put it in the code format block. Also, if there is an error being thrown please post the entire contents of the error message.
One thing I do see is that system.db.runQuery() cannot update. Use system.db.runUpdateQuery() instead. Better yet, consider using system.db.runPrepUpdate(), instead.