Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HELP! Can't Update the source table with a view
Message
From
09/01/1999 17:46:49
 
 
To
08/01/1999 22:02:28
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00172712
Message ID:
00174400
Views:
39
IF this is what you are doing (Nancy's question) then you really might wat to reconsider. When a view is opened, it opens copies of the tables it is based on (a view is just like an SQL SELECT, SQL SELECT do this too). But if a copy of the base table is already open in the current work area, the view just uses that copy when it updates. So if the base table is BUFFERED, after you update the view, you have really only updated the buffered table in the same work area. To get the changes back to the real table on disk, you have TABLEUPDATE the table. This is called the double buffering dilemma. Here's the problem:

USE myTable
CURSORSETPROP('buffering','mytable', 3) && set buffering to optimisteic row

USE MyView IN 0 && my is based on MyTable
CURSORSETPROP('buffering','myview', 3) && set buffering to optimisteic row


?GETFLDSTATE(-1,"MyView") && Returns "111"; "clean" buffer
?GETFLDSTATE(-1,"MyTable") && Returns "111"

REPLACE myView.Field1 WITH "Howdy, I'm from Texas"

?GETFLDSTATE(-1,"MyView") && Returns "211"; first field has been modified, "dirty" buffer
?GETFLDSTATE(-1,"MyTable") && Returns "111"

TABLEUPDATE(.T.,.T.,'MyView')

?GETFLDSTATE(-1,"MyView") && Returns "111"; now the view is clean
?GETFLDSTATE(-1,"MyTable") && Returns "211" but tha table is dirty

* And finally, to write changes to the base table you must
TABLEUPDATE(.T.,.T.,'MyTable')

?GETFLDSTATE(-1,"MyView") && Returns "111";
?GETFLDSTATE(-1,"MyTable") && Returns "111"















>Hi, Jack-
>
>So you are opening the source table in the DE of the form? I'm not entirely sure of the workings of this, but having the table open in the DE and (implicitly) open through using a view can be problematic, AFAIK.
>
>>Hi Edward.
>>
>>I solve my problem("Can't update source table....") this morning.
>>After I set the source table's BufferModeOverride to 0(it's 5 Original),
>>It works.
>>Thanks you.
>>
>>Jack Lee
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform