General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Updating Tables from Views
I posted this first in VFP7.0, but got no replies so I thought to try here too.
All tables in the below problem are “free” .
I created a “var_vw” programmatically from an empty “Vtable”.
Then I populated the view “var_vw” with data from a number of data views “dat_vw”
All views were created programmatically. The var_vw contains a “date” field & can contain a variable number of “var_” fields…var0 – varX depending on the number of variables needed.
I used views so all calculations could take place in RAM per recommendations from UT members…works great!!!
I can populate the var_vw fine. Now I want to update the entire associated “Vtable” (all columns), which has an alias “vtbl”.
None of my attempts using “dbsetprop” have worked. One attempt to update only the “var0” field/column is below:
Set multilocks on
=cursorsetprop(“buffering”,5,”vtbl”)
SELECT vtbl
DBSETPROP("var_vw","VIEW","TABLES","vtbl")
DBSETPROP(“var_vw.var0”, “field”, “UPDATENAME”, “vtbl.var0”
DBSETPROP("var_vw.date","FIELD","KEYFIELD" ,.t.) DBSETPROP("var_vw.var0","FIELD","UPDATABLE",.t.)
DBSETPROP("var_vw","VIEW","SENDUPDATES",.t.)
=TABLEUPDATE(.t.)
How do you use the DBSETPROP() function to update an entire Free table from its associated View?
By the way, using the COPY TO ARRAY command from the View and then appending the Array to the Table works. But I would like to know how to use the DBSETPROP() function.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only