Hi Guys
I am trying to set the data in a MYSQL field to NULL when a button is pressed in an UX Component. I have a button that when pressed fires an Ajax callback that fires an Xbasic function called deleteImage (together with an Actionscript that actually deletes the image). I am trying to base the update on the Primary Key and have tryed everything although I still trying to get my head around SQL and struggling a little. I am trying to set e._state.s_con_cont_id to the primary key in the onDialogExecute using
dim s_con_cont_id as C
e._state.s_con_cont_id = {id_contractor}
then in the Xbasic deleteImage function I have the following code
function deleteImage as c (e as p)
dim namedConnection as C
dim cn as sql::connection
dim args as sql::arguments
dim sqlqy as c
dim con_cont_id as N
con_cont_id = convert_type(e._state.s_con_cont_id, "N")
cn.open("::Name::CCS")
sqlqy = "UPDATE a1contstaf SET a1imagefilename = NULL WHERE a1idconsta = :cont_id)"
args.add("cont_id",con_cont_id)
cn.Execute(sqlqy,args)
cn.close()
end function
a1contstaf is the table, a1imagefilename is the file I am trying to make NULL and a1idconsta is the primary key.
I know its wrong as it doesn't work and would really appreciate any guidance.
Cheers
Paul
I am trying to set the data in a MYSQL field to NULL when a button is pressed in an UX Component. I have a button that when pressed fires an Ajax callback that fires an Xbasic function called deleteImage (together with an Actionscript that actually deletes the image). I am trying to base the update on the Primary Key and have tryed everything although I still trying to get my head around SQL and struggling a little. I am trying to set e._state.s_con_cont_id to the primary key in the onDialogExecute using
dim s_con_cont_id as C
e._state.s_con_cont_id = {id_contractor}
then in the Xbasic deleteImage function I have the following code
function deleteImage as c (e as p)
dim namedConnection as C
dim cn as sql::connection
dim args as sql::arguments
dim sqlqy as c
dim con_cont_id as N
con_cont_id = convert_type(e._state.s_con_cont_id, "N")
cn.open("::Name::CCS")
sqlqy = "UPDATE a1contstaf SET a1imagefilename = NULL WHERE a1idconsta = :cont_id)"
args.add("cont_id",con_cont_id)
cn.Execute(sqlqy,args)
cn.close()
end function
a1contstaf is the table, a1imagefilename is the file I am trying to make NULL and a1idconsta is the primary key.
I know its wrong as it doesn't work and would really appreciate any guidance.
Cheers
Paul
Comment