PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Finding the last Job Number and Adding 1
Finding the last Job Number and Adding 1
Iniciado por James, 09,may. 2012 14:28 - 1 respuesta
Miembro registrado
11 mensajes
Publicado el 09,mayo 2012 - 14:28
HExecuteQuery & HExecuteSQLQuery both return a true or false.

How do I find the last job number used and then add one ++. "SELECT MAX(ProjectNumber) FROM Project" returns the correct result from the query editor but I don't know how to translate that to a variable so I can add one and then update the record with a new job number.

Thanks in advance.
Miembro registrado
11 mensajes
Publicado el 09,mayo 2012 - 15:09
Every time I post I seem to work these out, despite looking over it for a while. I'll post my solution just in case some one stumbles upon it and offers a better solution.

HExecuteQuery(QRY_GetLastJobNumber)
IF ErrorOccurred THEN
Error("Error occurred getting the job number" + CR + HErrorInfo())
RETURN
END

EDT_ProjectNumber = QRY_GetLastJobNumber.LastProjectNumber+1