Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updatable Views - URGENT!
Message
From
25/11/1998 12:46:32
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, California, United States
 
 
To
24/11/1998 11:36:19
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00160967
Message ID:
00161470
Views:
20
Outer joins are notoriously tricky to get to work as updatable. The reason is because of the way that TABLEUPDATE converts edits into SQL. For example, a row that only exists for one side of the join will NOT be seen as a new row when values are changed for the side where no row existed (NULL). Calling TABLEUPDATE will generate an UPDATE statement instead of an INSERT statement and nothing gets updated.

The only way to really track it down (hopefully this is a remote view) is to watch what the SQL statement is that is being executed. I do this is SQL server by watching the current activity when I issue TABLEUPDATE(). If this doesn't make it clear I can help you out further if necessary. I've developed some (ugly) workarounds for similar problems.

Also, you don't make it clear below what the primary key is for MyTable. This could also be a potential problem if the primary key is not unique.

>I just can't seem to get this to work. I have a view defined in code as:
>
>CREATE VIEW MyView AS ;
>SELECT MyTable.*, MyCodeTable.CodeDesc, MyCodeTable.Code ;
>FROM MyTable ;
>LEFT OUTER JOIN MyCodeTable ;
>ON MyTable.CodeValue=MyCodeTable.Code ;
>WHERE MyTable.ID=?AnotherTable.ID
>
>I set all of the fields as Updatable EXCEPT the KeyField in MyTable and the fields in MyCodeTable. I set SendUpdates to true. I played around with the "Tables" property. By default it lists both tables. If I change it to specify only MyTable, when I make changes to the view it doesn't update MyTable. If the Tables property lists both tables and I delete a record in MyView, it deletes the corresponding records in BOTH tables. All I want is to be able to update MyTable. It shouldn't change anything in MyCodeTable.
>
>What am I missing?
>
>Thanks for any help,
Eric Shaneson
Cutting Edge Consulting
Previous
Reply
Map
View

Click here to load this message in the networking platform