Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about views
Message
From
28/04/2006 18:07:47
 
 
To
28/04/2006 17:45:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01117697
Message ID:
01117705
Views:
14
Hi Hilmar

Simply call the UDF that assigns the primary key from the View's Default, not the table, you will need to make the Primary Key field updateable.

Bruce

>How should the following situation be handled?
>
>The primary key in a table is assigned through a function, through its default value.
>
>In a parameterized view (local view), the primary key field is marked as a primary field, and is not updatable. All other fields are updatable.
>
>When the user creates a new record (the datasource is the local view), and saves it, the table receives its PK correctly (through the default value), and all other fields get updated correctly. However, the PK in the view still has the value zero, since no data is returned from the view to the table. Therefore, if the user does changes to the newly created record, these changes can't be saved, since the PK is invalid. There are also a few other problems, related to the missing PK in the view.
>
>If, on the other hand, the user closes the form (the one that uses the p-view) and opens it again, the data is read correctly, and the record can be saved. Also, I might do a requery(); but it seems inefficient to requery() the entire set of data every time a single record is saved (only for new records). I thought there must be another way.
>
>I think there might be some bad design in the structure explained above, but I can't spot it.
>
>TIA,
>
>Hilmar.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform