Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't update underlying tables from view
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Can't update underlying tables from view
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01100448
Message ID:
01100448
Views:
59
I am using a view of three tables using this code, I've changed names of tables, but each has a unique_ref field which is the common link as well as maybe 20 or so character fields. After running the below I try and update my clients view, but after using =TABLEUPDATE(.t.,.t.) with the view in use, it won't update. I've seen this type of question posted before, but seamingly without a satisfactory resolution posted. If anyone can help me, that would be great and I would be very grateful.

Code Snippets :

CREATE DATABASE testing
&& My free tables are called introsDB, keysDB, genderDB, they are not in the database and none have indexs set as of yet.
&& the content of them is irrelevent except that I use an outer join below to make sure I return the maximum number
&& of records as some tabels may be empty on occasions.


CREATE SQL VIEW clients AS SELECT introsDB.*,keysDB.*,genderdb.* FROM introsDB LEFT outer JOIN keysdb ON introsDB.unique_ref = keysDB.unique_ref LEFT outer JOIN genderdb ON keysDB.unique_ref = genderdb.unique_ref


&& All the above are free tables, the database just acts as a store to allow me to reach the goal of using a view.
&& Then I am adding the DBSET properties to make sure the database is updatable and the underlying tables can take the updates


DBSETPROP('clients', 'View', 'Tables','introsDB, keysDB, genderDB') &&To pass what tables I wish to update

FOR every FIELD in every TABLE && Pseudo-code
DBSETPROP('clients.fieldname1','Field','UpdateName','introsDB.fieldname')
DBSETPROP('clients.fieldname1','Field','Updatable', .T.) && I do this for each field in each table, but not the key fields
ENDFOR

DBSETPROP('clients.unique_ref', 'Field', 'KeyField', .T.) && Set the keys
DBSETPROP('clients.unique_ref1', 'Field', 'KeyField', .T.) && Unique_ref in keysDB
DBSETPROP('clients.unique_ref2', 'Field', 'KeyField', .T.) && Unique_ref in genderDB
DBSETPROP('clients','View','SendUpdates', .T.)
= CURSORSETPROP('Buffering', 5,'clients')

Am I missing anything, or is this beyond the scope of a view?
Cursing is the subclass of drunken working... Oscar Wilde (abridged)
Next
Reply
Map
View

Click here to load this message in the networking platform