Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to use updateable views...
Message
From
06/11/1998 17:09:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Trying to use updateable views...
Miscellaneous
Thread ID:
00155397
Message ID:
00155397
Views:
60
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
Next
Reply
Map
View

Click here to load this message in the networking platform