Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
More on saving a multi-table view
Message
De
29/04/1999 13:03:11
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00213524
Message ID:
00213537
Vues:
35
I have views like this that I update. I have found that at times VFP decides it needs to update both tables even though no fields from the second table are marked as updateable. What I do is use GENDBC to generate all of the view code and then edit the statement that indicates which tables are updateable. Usually the second table is in the list and it can be removed. The run this code to recreate the view.


>here is some more info to further explain my problem. the original question is at the bottom.
>
>even though my view has data from two tables i am only trying to update one of the tables. the reason that i have used two tables to create the view is because i want the user to see the character code equivalent of the FK which is an integer.
>
>both of my tables have PK's in the structure, but i did not include the PK from both tables in the create view statement.
>
>in the example select statement below, TABLE1 is the child table (the one i want to update). the FK from TABLE1 relates to the PK of TABLE2.
>
>what i am trying to do in the grid is edit the field that was derived from TABLE2 because it is a code that the user picks from a combo box control. based on the combo box code selected, i want to update update the TABLE1.FK column in the combo box valid event.
>
>original question...
>
>i have a view that combines data from two vfp tables.
>
>the tables are related through a foreign key and the fk's are
>used as the inner join condition between the tables. here is
>how my code looks...
>
> create sql view MYVIEW ;
> as select ;
> TABLE1.PK , ;
> TABLE1.FK , ;
> TABLE1.COLUMN1 , ;
> TABLE1.COLUMN2 , ;
> TABLE1.COLUMN3 , ;
> TABLE2.COLUMN1 , ;
> from TABLE1 ;
> inner join TABLE2 ;
> on TABLE1.FK = TABLE2.PK
>
>i displayed the rows from the view in a grid.
>
>i can edit TABLE1.COLUMN2, TABLE1.COLUMN2, TABLE1.COLUMN3 and
>successfully update the base table. when i edit TABLE2.COLUMN1 the
>tableupdate fails.
>
>i have tried different combinations of dbsetprop and cursorsetprop
>calls to set the tables and fields that can be updated but i have not
>had any luck.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform