Sql update on clarion


#1

Hi,
does sql syntax like update or delete can be run on clarion ?
I’m trying to update a record by {PRP:SQL}
and it’s cannot giving result like I want. my syntax is
whrhead{PROP:SQL} =‘update whrdet set Wrd:No_brg=’’&1122&’’’
hope somenone can help…

thanks


#2

Try:

whrhead{PROP:SQL} =‘update whrdet set No_brg=’’&1122&’’

#3

Hi There,

You don’t say what ‘flavour’ of SQL database you’re using?

Anyway things to note are prop:sql statements get sent direct to the backend, so the syntax must be the syntax the backend expects.
So for example the backend knows nothing about Clarion’s table prefixes - so your string WRD:No_brg will fail.
Also you must immediately follow your prop:sql statement with error checking eg

whrhead{prop:sql} = 'update whrdet set ....etc etc
if errorcode()
   message(choose(errorcode()=90,fileerror(),error()),'Error on prop:sql')
end

That error checking would/will show you the error in using the prefix.

You should enclose values that are strings in quotes, but you don’t need to enclose numbers in quotes.

As it stands your prop:sql will change EVERY row of the whrhead table so that No_brg is 1122
If that’s not what you want then you must add a WHERE clause so that the backend knows which row to change.

Graham


#4

it is sql server…and i’ll try your solution

thx