PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Windev  : insert query + get last inserted id
Windev : insert query + get last inserted id
Iniciado por guest, 15,feb. 2011 11:42 - 3 respuestas
Publicado el 15,febrero 2011 - 11:42
Hello,
i want to use an insertquery in windev and then immeadiately ask the inserted key.
I know i can do it by "max" but is it realy this inserted key that he returns..
Imagine when someone else inserts on the same moment a key and you ask for the max.
How can you be sure that the id is your inserted key.
hexecutequery(INSERTQUERYNAME)
thanks
Publicado el 15,febrero 2011 - 14:50
Hi,
will this do the trick
Rec is string = HRetrieveRecord(INSERTQUERYNAME)
Returns the content of the current record (in a file, a view or a query, ...).
Publicado el 15,febrero 2011 - 16:49
I tried to :
qry_AddStop.ParamSoortnr = IncSoortNr
HExecuteQuery(qry_AddStop)
laatstestop is string = HRetrieveRecord(qry_AddStop)

and it gives me an error :
Erreur à la ligne 15 du traitement Procédure globale ProcG_Qry_addStop.
Vous avez appelé la fonction HRécupèreEnregistrement.
Fichier inconnu dans l'analyse , ou requête ou vue non initialisée.
Si il s'agit d'une requête, l'exécution de cette requête a peut-être échoué.
----- Informations techniques -----
Projet : DistriWork
Appel WL :
Traitement de 'Procédure globale ProcG_Qry_addStop' (ProcéduresGlobales.ProcG_Qry_addStop), ligne 15, thread 0
Fonction 'HRécupèreEnregistrement', syntaxe 1
Que s'est-il passé ?
Fichier inconnu dans l'analyse , ou requête ou vue non initialisée.
Si il s'agit d'une requête, l'exécution de cette requête a peut-être échoué.
Code erreur : 70018
Niveau : erreur fatale (EL_FATAL)
Code erreur WD55 : 18
Publicado el 16,febrero 2011 - 11:28
with retrieveitem it works , but not on the queryname but on the table itself.
lastInsertedRecord is string = HRetrieveItem(Tabelnaam,ItemnummerOfKey)