Topic: Sql Update

Hi All

Quick question, the line below works fine

SQLExecute ('update tools set machine = '+mach_tool.edit2.text+' where id_jobs = '+mach_tool.edit11.text+' ');

Except when the text string (mach_tool.edit2.text) contains an ("), then the sql command reads this as the end of the string.
I know i'm using the wrong syntax here, but don't know the correct one.

Any help would be great.

John

Re: Sql Update

Hi John,
Does doing it like this (see attached) get round the problem?
Derek.

Post's attachments

Attachment icon johnquotes.zip 340.37 kb, 213 downloads since 2021-04-13 

Re: Sql Update

Thanks again Derek,

Yes it worked fine, and very clever in my mind.

I actually did this.

mach_tool.edit2.text := replacestr(mach_tool.edit2.text,'"','""');
SQLExecute ('update tools set machine = "'+mach_tool.edit2.text+'" where id_jobs = '+mach_tool.edit11.text+' ');
mach_tool.edit2.text := replacestr(mach_tool.edit2.text,'""','"');

Kind regard and much appreciated.

John