Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to use updateable views...
Message
De
06/11/1998 17:09:32
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Trying to use updateable views...
Divers
Thread ID:
00155397
Message ID:
00155397
Vues:
62
I've written a little test routine to familiarize myself with updateable views... It does not seem to be working as expected.

When I browse the view and change something... that change should be saved to the dbf table using TABLEUPDATE() right? Well, the changes are not being saved...

I'm sure it's something simple but I'm just not catching it.

Here's the code:
CLOSE ALL
CLEAR ALL
CLEAR

SET EXCL OFF
SET SAFE OFF
SET TALK ON
SET MULTILOCKS ON

CREATE TABLE TstParent ( PrntID c(3), PrntName c(20) )
CREATE TABLE TstChild ( PrntID c(3), ChildID c(3), ChildName c(20) )

INSERT INTO TstParent ( PrntID, PrntName ) VALUES ( '001', 'Parent #1' )
INSERT INTO TstParent ( PrntID, PrntName ) VALUES ( '002', 'Parent #2' )
INSERT INTO TstParent ( PrntID, PrntName ) VALUES ( '003', 'Parent #3' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '001', 'Child #1' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '002', 'Child #2' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '003', 'Child #3' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '004', 'Child #4' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '005', 'Child #5' )
INSERT INTO TstChild  ( PrntID, ChildID, ChildName ) VALUES ( '001', '006', 'Child #6' )

* I want to use pessimistic row buffering
IF CURSORSETPROP("Buffering", 2, "TstParent" ) AND CURSORSETPROP("Buffering", 2, "TstChild" )

    cPrntID = '001'

    CREATE DATABASE TestView

    CREATE SQL VIEW TestView AS SELECT .F. AS MARKED, TstParent.*, TstChild.ChildName ;
        FROM TstParent LEFT JOIN TstChild ON TstParent.PrntID=TstChild.PrntID ;
        WHERE TstParent.PrntID=?cPrntID

    * make some change to ANY field
    USE TestView
    BROWSE
    
    ? 'UPDATED ',TABLEUPDATE(.T.)

    SELECT TstParent
    BROWSE
    SELECT TstChild 
    BROWSE

ENDIF
If anyone can offer a solution, I would be most grateful!

Thanks
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform