Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tableupdate Loop
Message
De
21/05/2017 10:54:29
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Tableupdate Loop
Divers
Thread ID:
01651279
Message ID:
01651279
Vues:
57
Listed is the code below that I am wanting to insert new record or update existing record within a view. The intent is to have the system to loop the tableupdate command if, for some reason it returns a FALSE. Am I heading down the right track in accomplishing this? Any recommendations?


select lv_urspwd
=REQUERY('lv_urspwd')

llSavePwd = .f.


IF _tally = 4 &&Max number of passwords have been captured as changes. Need to capture the oldest password and update that record with the new password
GO TOP &&If there are 4 passwords for this users already, update the latest password which should be the TOP record

replace urspwd_rec WITH oPro.encript(ALLTRIM(ThisForm.Emp_Pwd_Txt.Value))
replace usrpwd_date WITH DATE()
ELSE &&this must be a new employee entry
INSERT INTO lv_urspwd (fk_emp_id, urspwd_rec, usrpwd_date) ;
VALUES (oVar.fk_user_id, oPro.encript(ALLTRIM(ThisForm.Emp_Pwd_Txt.Value)), DATE())

ENDIF

SELECT lv_urspwd

DO WHILE llSavePwd = .F.

llsavePwd = TABLEUPDATE(1,.t.)

IF llSavePwd = .F.
WAIT WINDOW 'Still attempting to save record....please wait ' TIMEOUT 8
LOOP
ELSE
EXIT
ENDIF
ENDDO
Thanks in Advance.

J. Turner
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform