ALGUNA SUGERENCIA DE DONDE ESTA EL ERROR | Some suggestion where the error is - Forum

Forum Navigation
You need to log in to create posts and topics.

ALGUNA SUGERENCIA DE DONDE ESTA EL ERROR | Some suggestion where the error is

Buen Dia! @luishp,@gaev,@asleycruz,@daviddeargentina

ESPAÑOL

Tengo una base de datos que tiene dos tablas

usuarios
saldotmp

En la tabla usuarios tengo un campo que es "totalretorno"
En la tabla saldotmp tengo un campo que es "saldo"

Intento agregar a la tabla saldotmp en el registro saldo el valor que contiene la variable "totalretorno" de la tabla usuarios...

SetVar "[gestion.saldotmp.saldo]" "[gestion.usuarios.totalretorno]"
dbpExecSQL "gestion" "INSERT INTO saldotmp (saldo) VALUES ([gestion.usuarios.totalretorno])" "[s1]"

No me funciona no se en donde le estoy errando... alguna idea?

ENGLISH

I have a database that has two tables

Users
balance

In the table users I have a field that is "totalretorno"
In the saldotmp table I have a field that is "saldo"

I try to add to the saldotmp table in the balance registry the value contained in the "totalretorno" variable of the users ...

Setvar "[manage.saldotmp.saldo]" "[manage.usuarios.totalretorno]"
DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES ([GESTION.USUARIOS.TOTALRETORNO])" "[S1]"

I don't work for me where I'm erring ... Any idea?

 

en mysql seria asi. sino me equic0?

faltan las ' '

DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES ('[GESTION.USUARIOS.TOTALRETORNO]')" "[S1]"

Gracias @ragman por su asistencia pero no funciona me dice que no coinciden las expresiones....

le puse las comillas tal como lo sugeriste pero aun asi no me funciona....

 

dbpExecSQL "gestion" "INSERT INTO saldotmp (saldo) VALUES ('[gestion.usuarios.totalretorno]')" "[s1]"

@joferar333

I am not sure what exactly is not working for you ...

1) try this ...

SetVar "[gestion.saldotmp.saldo]" "[gestion.usuarios.totalretorno]"
AlertBox "variables" "[gestion.saldotmp.saldo] ... [manage.users.totalrestor]"

... is the value of saldo in the current record of saldotmp updated ?

 

2) In the dbpExecSQL command, what is the value and purpose of [s1] ?

a) Try this first ...

DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES (6789)" ""

... this should insert a new record in saldotmp with the value of field balance equal to 6789

b) If (a) does not work as expected, try this ...

DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES ('6789')" ""

c) If (a) works as expected, try this ...

SetVar "[BalanceValue]" "1234"
DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES ([BalanceValue])" ""

d) If (c) does not work as expected, try this ...

SetVar "[BalanceValue]" "1234"
DBPEXECSQL "GESTION" "INSERT INTO SALDOTMP (BALANCE) VALUES ('[BalanceValue]')" ""

Post your results for each syntax here.

Vadim has reacted to this post.
Vadim

ok, revisemos los campos de la Tabla,

así manejo los datos con mysql, y no tengo problema, solo el único campo que no coloco es id_archivo =int ( autoincrementa )

1 int(11) AUTO_INCREMENT

2 varchar(200) NULL

3 varchar(255) NULL

4 varchar(8) NULL

5 varchar(1) NULL

6 varchar(6) Sí NULL

7 varchar(255) NULL

8 int(10)  Sí NULL

dbpExecSQL "mysql" "INSERT INTO archivoz (archivo,mostrar,rut,estado,periodo,fullname)| VALUES ('[campo_archivo]','[campo_mostrar]','[campo_rut]','[campo_estado]','[campo_periodo]','[campo_fullname]');" ""

 

NOTA: no paso valores de una tabla a otra directamente, los paso a una variable temp, para revisar.

y lo otro, lo estas grabando a una tabla de resultado?

@ragman

Thanks, new found Ok!

 

t