Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View updates not working
Message
From
18/10/1999 08:42:48
 
 
To
17/10/1999 21:35:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00277474
Message ID:
00277601
Views:
24
Hi John,

So are you saying that I should have a unique value in a field for EVERY record. If it is the 'child' table that contains the product name, and one component of the formula in each record, in addition, each record that contains the component should also have a different value in a field that is unique to it?


>Hi Mary-Ann,
>
>If you could post the SQL from the view, perhaps a strategy could be devised to remedy the situation painlessly :-)
>
>Regardless, a product name does not sound like a good choice for a keyfield. For one, it can be changed at will by the user; for two, it's not unique. Now, is there any combination of fields from the main table in the view that you can guarantee would be unique in the view? You can check off more than one key field, you know, to create a compound key. This might be a stopgap solution.
>
>All in all, though, you need to think down the road into creating a surrogate key field (a field that is maintained by the system and has no user informational data) and put a unique value into that field when a new record is created. Maybe using a sequential number or a GUID (see Rick Srahl's web-site for good GUID code).
>
>>
>>So, I have several tables, one is the 'main' table. They all have a field named 'product' (product name). Each table is indexed on this field. the main table has one product name that is different in each record. One of the other tables (one to many relationship) has the same product name in several records as each record is a 'component' of the formulation for the product. Is that the problem? I don't get it. Seems like I Have to have the product in each record. help.
>>
>>
>>>Hi Mary-Ann,
>>>
>>>As Ed points out, the key value for the KeyField is not unique. You see, for a view to update or delete correctly, one field has to be identified as the key field. This field has to be absolutely unique. To save you some time, this also means that you are going to want to use INSERT INTO to prepopulate this field with a unique value when inserting records.
>>>
>>>As Ed also points out, if you can create a Primary or Candidate key on the field without an error, it's usable as the keyfield in a view.
>>>
>>>
>>>>"The key defined by the KeyField Property for table dbc.table is not unique". Seems like a simple message, but I don't really understand what it means.
>>>>
>>>> Get this error when trying to delete or update from the view. The table has one key field that it's indexed on, the view is indexed on the same key field name. Have clicked on the key field on the update tab and those fields to update. Don't understand the problem.
"Live Well, Laugh Often, Love Much..."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform