Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database Transaction statement madness
Message
De
16/02/2004 10:10:38
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00875488
Message ID:
00877643
Vues:
17
If what I think is happening is true your case, this has been a recurring problem for a very long time and is due to local and/or network caching not "seeing" the recently added records. Try adding the following statements before your requery.

RLOCK(lcAlias)
UNLOCK IN (lcAlias)

The RLOCK(), whether successful or not, seems to force caches to refresh.

HTH

>Hello. I've been having problems using the begin transaction, txnlevel, and end transaction statements. The controls on my form are bound to a view. A new record is being added to the table, but whenever the requery(nameoftheview) statement executes, the new record does not appear on the form nor the view. Below is the code i'm using as well as some of my comments. This application is running on a server, although I'm testing it on a stand alone pc. Are these transaction statements necessary. Any help would be greatly appreciated. Thanks.
>
> BEGIN TRANSACTION
> IF .Adding
> lcCntrlNbr = NewCntrlNbr("OMHSAS", "OmhSasCorrespondence")
> IF LEN(ALLTRIM(lcCntrlNbr)) != 13
> ROLLBACK
> =MESSAGEBOX( ;
> "A control number was not generated for this " + ;
> "OMHSAS correspondence record. You can " + ;
> "try again or cancel the addition.", ;
> MB_OK + MB_ICONEXCLAMATION, ;
> "OMHSAS Control Number")
> RETURN .F.
> ELSE
> REPLACE ;
> lvOmhSasCorrespondence.cCntrlNbr ;
> WITH lcCntrlNbr ;
> IN lvOmhSasCorrespondence
> ENDIF
> REPLACE ;
> (lcAlias + ".cAddedBy") WITH OmhSasCorr.rcEmpNbr, ;
> (lcAlias + ".tAddDate") WITH DATETIME() ;
> IN (lcAlias)
> ELSE
> REPLACE ;
> (lcAlias + ".cUpdatedBy") WITH OmhSasCorr.rcEmpNbr, ;
> (lcAlias + ".tLastUpd") WITH DATETIME() ;
> IN (lcAlias)
> ENDIF
>
> IF TABLEUPDATE(0, .F., lcAlias)
> IF TXNLEVEL() != 0
> END TRANSACTION
> ENDIF
> SELECT (lcAlias)
>
>******* AT this point, I started debugging the code, and the new record was added to ******* the view.
> .rcKey = EVALUATE(lcAlias + ".cCntrlNbr")
>******* When the following statement executes, I browsed the view and the new record ******* was not in the view and didn't appear on the form, but it made it to the table.
> =REQUERY("lvOmhSasCorrespondence")
> SET NEAR ON
> =SEEK(.rcKey, lcAlias, "CntrlNbr")
> If EOF(lcAlias)
> LOCATE
> ENDIF
> STORE .F. TO .Adding, .Updating
> .SetAccess()
> .ModeCancel()
> ELSE
> SELECT (lcAlias)
> IF TXNLEVEL() != 0
> ROLLBACK
> ENDIF
> .Error()
> ENDIF
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform