PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → WINDEV Code
WINDEV Code
Iniciado por Vinit Sawant, dez., 13 2017 9:25 AM - 3 respostas
Publicado em dezembro, 13 2017 - 9:25 AM
Hi,
I'm having one small code in my application but I'm not able to understand it as I'm new to this technology.

pModule est un Module = paModule
pDossier est un Dossier dynamique = paDossier
// ETAPE 1 - on supprime les modifs précédentes
Requête_DT_enregistrées_supprimer.p_Dossier = FenInt_DT_module.pDossier:identifiant
Requête_DT_enregistrées_supprimer.p_Module = FenInt_DT_module.pModule:ordre
SI PAS HExécuteRequête(Requête_DT_enregistrées_supprimer) ALORS
Logger:Erreur(ChaîneConstruit("Echec suppression des anciennes Données Techniques du module %1",FenInt_DT_module.pModule:ordre),ErreurInfo())
RENVOYER Faux
FIN


If someone help me out to understand this code and also when the error mentioned in the code will be come then it will be very useful.

Thanks in advance.
Publicado em dezembro, 13 2017 - 10:35 PM
Hi Vinit,

Line 4 and 5 supply the parameters to a delete query.
Line 6 executes the query.
If it fails the error will be logged.

Kind regards,
Piet
Publicado em dezembro, 14 2017 - 6:57 AM
Hi Piet,

Thanks for your answer.
Can you please also tell me under what circumstances "Echec suppression des anciennes Données Techniques du module %1" this error will occur?

Regards,
Vinit
Publicado em dezembro, 14 2017 - 10:01 AM
Vinit,

in normal situation where everything runs fine a query will not give an error.

But sometimes things go wrong, when for instance network/server is slow you can get a timeout,

When you change your analysis most of the time Windev will alert you to modify queries as well or do it for you. Sometimes this fails and then you run a query against a database where fieldnames may differ. This will also throw an error.

Or your query deletes records which have childrecords. Depending on your database-constraints you may need to delete the child records first. Therefore the query fails. This situation however must be handeld in your code beforehand, so it is actually a developers fault.