Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update Conflict on Tablerevert() ??????
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00082894
Message ID:
00082938
Vues:
27
>I have a form with three tables and have buffering set to opt 3 for all tables. I do have an error handler for my updates and it works fine until I try to revert after an update conflict. the reverts are placed in a for loop which processes an array that holds the table names to revert. The first pass on the for loop reverts the master table; this goes fine. The problem occurs when the first child table is reverted. I get an update conflict message here. Below is a portion of the class code that handles this. Sorry for the messy looking code. the text got scrambled when I pasted it here:-(
>
>Thanks!!
>
>John.
>
>
>
>DO WHILE TXNLEVEL( ) > 0
> ROLLBACK
>ENDDO
>
>SET REPROCESS TO AUTOMATIC
>
>this.setaliases(this.rtablelist) &&Parse the table list in array
>
>LOCAL llValid, llRevertall
>llRevertall = .F.
>
>BEGIN TRANSACTION
>FOR i = 1 TO ALEN(this.paAlias, 1)
>llValid = TABLEUPDATE(1, .F., this.paAlias[i])
>IF NOT llValid *If not successful, do error check
>AERROR(aErrors) &&Get the error from AERROR( ).
>DO CASE &&Determine the cause of the failure.
> CASE aErrors[1,1] = 1585 &&If a record changed by another user,
> IF llRevertall = .F.
> nResult = MESSAGEBOX;
> ("Data was changed by another user... " + ;
> "Do you want to keep your changes "+ ;
> "and overwrite the other users modifications?", 4+48, ;
> "Modified Record")
> IF nResult = 7 &&If user responded “No,”
> llValid = .F. &&Set to do rollback and revert
> llRevertall = .T. &&If this is .T. revert ELSE
> llValid = TABLEUPDATE(1, .T., this.paAlias[i]) ENDIF
> ENDIF
> CASE aErrors[1,1] = 109
> llValid = .F.
> Recordinuse =Messagebox("This record is in use by another. "+;
> "Please click on OK now to revert your changes", 48 ,
> "User edit cancellation") EXIT
> OTHERWISE &&Otherwise, present a dialog box to the user.
> MESSAGEBOX( "Unknown error "+;
> "message: " + STR(aErrors[1,1]))
> ENDCASE
>ENDIF
>ENDFOR
>
>IF llValid AND llRevertall <> .T.
> END TRANSACTION
>ELSE
> ROLLBACK
>*!* Do a tablerevert() for the tables in rtablelist
>*!*THE ERROR OCCURS HERE ON THE SECOND PASS (FIRST CHILD TABLE)
>
> FOR i = 1 TO ALEN(this.paAlias, 1)
> TABLEREVERT(.T., this.paAlias[i])
> ENDFOR
>ENDIF

Where have I seen this before? Long ago back in the 3.0 days when I created this class I got this same problem a time or two. For the life of me I cannot remember what it was and what I did to correct it. I haven't seen it in a long time. I'll be watching this thread though and if I think of it, I'll certainly let you know.

Steve
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform