Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tableupdate reports .t. but doesn't update all records
Message
De
19/07/2005 13:12:16
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01033910
Message ID:
01033923
Vues:
14
>Hi everybody,
>
>I have buffering 5 for the view. I'm trying to use force update.
>
>Here is my code in pre save hook:
>
>WITH THIS
>	IF .IsNew()
>
>		lcTrans_Relateds_pk = cTrans_Relateds_pk
>		.cAction_code = 'AD'
>		REPLACE cRelateds_fk WITH IIF(cTrans_Relateds_pk == lcTrans_Relateds_pk, v_Relateds.cRelateds_pk, cRelateds_fk) ;
>			cTrans_fk WITH THISFORM.cTrans_pk, ;
>			iGuarantor_flag WITH 1, ;
>			iPrimary_flag WITH IIF(cTrans_Relateds_pk == lcTrans_Relateds_pk,1,0) ALL
>		
>	ELSE
>		.cAction_code = 'CH'
>	ENDIF
>
>	.lSaveTransEvents = .T.
>	.cDetail_Info = ""
>	.cFunction_Code = "GU"
>	.cTrans_fk = THISFORM.cTrans_pk
>ENDWITH
>
>
>However, after I clicked on save button, only the last new record is get updated. The other records remain the same and the iPrimary_flag is still 1 for them. I'm using TABLEUPDATE(.t.,.t.) If I'm doing it slowly using the debugger, it usually updates correctly.
>
>What could be wrong here? Why I can not change all the records?
>
>In fact, I only want to make the new record to be primary and the previous record with flag = 1 to be 0.
>
>What could be wrong here?
>
>Thanks in advance.

Nadya,
-Add alias parameter to TableUpdate()
-Be sure underlying table is also not buffered (if it's it needs a tableupdate too).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform