Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replication
Message
De
22/10/1997 07:25:13
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, États-Unis
 
 
À
22/10/1997 06:51:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00055965
Message ID:
00055969
Vues:
33
>>>How would I maintain a replica of a .dbf in a second location?
>>>
>>>I only want the changed data to be updated.
>>>
>>>TIA
>>
>>Add Code to the triggers to add/edit/delete same information in second table.
>
>Could you give me an example? I've never done that.

Well, I'll give you a start, if I can:

First, your tables will need to have a primary key defined.

Then in the Trigger boxes, call these procedures:
PROC CopyUpdate
LOCAL llReturn

SELECT MyTable2  && assume order set to PK
SEEK MyTable1.PK
IF FOUND()
  REPL Field1 WITH MyTable1.Field1, ; 
       Field2 WITH MyTable1.Field2, ;
       Field3 WITH MyTable1.Field3, ;
       Field4 WITH MyTable1.Field4
  llReturn = .T.
ELSE
  llReturn = .F.
ENDIF

SELECT MyTable1

RETURN llReturn

PROC CopyInsert

INSERT INTO MyTable2 ( PK, Field1, Field2, Field3, Field4) ;
       VALUES (PK, Field1, Field2, Field3, Field4)

RETURN .T.

PROC CopyDelete
LOCAL llReturn

SELECT MyTable2  && assume order set to PK
SEEK MyTable1.PK
IF FOUND()
  DELETE
  llReturn = .T.
ELSE
  llReturn = .F.
ENDIF

SELECT MyTable1
Obviously, you'll need code for buffering and messaging, but that should give you an idea.

HTH
Matt McDonnell
...building a better mousetrap with moldy cheese...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform