Page 1 of 1

csql := oCon:UPDATE( "clientes" , SOLUCIONADO

Posted: Mon Aug 31, 2020 3:22 am
by D.Fernandez
Hola, alguien me podria ayudar con esta sintaxsis por favor.


cCod := "2001"
nom := "Dario"
numercli es el numero del cliente

csql := oCon:UPDATE( "clientes" , "nomcli", nom , WHERE numercli = cCod )

Gracias, no le doy en la tecla y no encontré ningún ejemplo.

Saludos

Dario Fernandez

Re: csql := oCon:UPDATE( "clientes" , "nomcli", nom , ...

Posted: Mon Aug 31, 2020 4:03 am
by nageswaragunupudi

Code: Select all

oCon:Update( "clientes", { "nomcli" }, { nom }, { { "numercli", cCod } } ) --> Number of rows updated
If you want to see the SQL statement built

Code: Select all

cSql := oCon:UpdateSQL( "clientes", { "nomcli" }, { nom }, { { "numercli", cCod } } )
? cSql
 
Result:

Code: Select all

UPDATE `clientes` SET `nomcli` = 'Dario' WHERE `numercli` = '2001'
Second parameter is an array of fieldnames or list of fieldnames.
Third parameter is an array of values.
Fourth parameter can be
1) an multi-dim array of fieldnames and values.
2) Literal where condition.

In the above example, the fourth parameter can also be:

Code: Select all

"`numercli` = '" + cCod + "'"
 
but specifying as an array may be more convenient.

Re: csql := oCon:UPDATE( "clientes" , "nomcli", nom , ...

Posted: Mon Aug 31, 2020 4:06 am
by rubenfernandez01
Thanks a lot. I'm trying sql.

Diario Fernández,.

Enviado desde mi Redmi Note 8 Pro mediante Tapatalk