Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BIG problem with Begin Transaction / EndTransaction / Roolba
Message
De
15/02/2001 14:47:18
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
BIG problem with Begin Transaction / EndTransaction / Roolba
Divers
Thread ID:
00476437
Message ID:
00476437
Vues:
72
I have BIG problem with Begin Transaction / EndTransaction / Roolback

Table1->
CREATE TABLE 'TABLE1.DBF' NAME 'TABLE1' (IDCODE N(3, 0) NOT NULL)
SET COLLATE TO 'GENERAL'
INDEX ON IDCODE TAG IDCODE CANDIDATE

Im sending a simple sample of a form with 3 buttons ( NEW / SAVE / REVERT ).
One grid with the values and an textbox where user tipes the value.

In station 1 a user opens form1, and click NEW button
in station 2 another user opens the same form1 and click NEW button
and insert a value, saves all when he clicks on SAVE button.
Supose (3)

At the station 1, the user tipes the Same value (3) and them click in the
SAVE button of the form, but becomes error 1884, and it Rollback( Good ).

Problem: when the user from station 1 clicks again the SAVE button it Saves
the value in to the transaction even if the value is duplicated in a CANDIDATE Index
So I have duplicate value in a Candidate index Field !!

How can I solve this problem, because user needs to time the code, I cant generate
it like Tastrade sample.

Does someone has an Idea how to handle this simple problem ?

Below is the code of the form.

Before load Method in Environment:
==============================
SET MULTILOCKS ON
SET TALK OFF
SET SAFETY OFF
SET REPROCESS TO 1
SET REFRESH TO 1
SET DELETED ON
SET CONFIRM ON
SET HELP OFF
SET ESCAPE OFF
SET NOTIFY OFF
SET BELL OFF
SET DATE FRENCH
SET CONSOLE OFF
SET CENTURY ON
SET CENTURY TO 19 ROLLOVER 10
SET COLLATE TO "GENERAL"
SET NULLDISPLAY TO ""

Activate of Form1:
===============
SELECT TABLE1
GO TOP

NEW Button:
===========
SELECT Table1
APPEND BLANK
ThisForm.Refresh()
ThisForm.txtidcode.SetFocus()

SAVE Button:
===========
BEGIN TRANSACTION
IF TABLEUPDATE(.T.,.F.,"Table1")
wait window STR(reccount()) + " ok "timeout 1.5
END TRANSACTION
ELSE
ROLLBACK
wait window STR(reccount()) timeout 1.5
=AERROR(mverror)
IF TYPE("mverror")<>"U"
WAIT WINDOW STR(mverror[1,1]) TIMEOUT 1.5
ENDIF
ENDIF
ThisForm.Refresh()

REVERT Button:
==============
=TABLEREVERT(.T.,"Table1")
ThisForm.Refresh()
ThisForm.txtidcode.SetFocus()


Please could someone help me please !

TIA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform