Error updating DB from runUpdateQuery

Hi Guys,

I have the below action script on a button that takes the updated text in a text area and updates the DB table. It works fine most of the time but when some specific characters are used it errors.

[code]ID = event.source.parent.getComponent(‘Table’).SelectedID
Note = event.source.parent.getComponent(‘Text Area’).text
DB = system.tag.read("[]Plant Info\Project Name")

system.db.runUpdateQuery(“UPDATE notes SET NoteText = ‘%s’ WHERE ID = %s” % (Note,ID), DB.value)
system.gui.messageBox(“Update Completed”)[/code]

I have read that using the runPrepUpdate would possibly solve the issue but cant get my head around making the PrepUpdate work??

Using MS SQL

Any help would be fantastic…

Cheers

Tim…

You should use the runPrepUpdate funcition:[code]ID = event.source.parent.getComponent(‘Table’).SelectedID
Note = event.source.parent.getComponent(‘Text Area’).text
DB = system.tag.read("[]Plant Info\Project Name")

system.db.runPrepUpdate(“UPDATE notes SET NoteText = ? WHERE ID = ?”, [Note,ID], DB.value)
system.gui.messageBox(“Update Completed”)[/code]

Haha, Thanks Travis,

I had tried various interations that just didn’t work.

But I now see the error of my ways…

cheers for the help.