This topic is locked
[SOLVED]

 Can't edit table with compound key?

6/21/2016 1:24:05 PM
ASPRunner.NET General questions
Pete K author

I have a table that utilizes a compound PK where each of two fields is the foreign key to another table. Unfortunately using this scheme my generated app refused to allow me to edit one of the two key fields. It would seem to take if I edited inline, but would revert upon refreshing the page. In standalone edit page mode, it just returned to the list page with no message and no change recorded. As a test of my database structure, I verified that I could edit these fields directly in SQL server. After trying all sorts of things including starting over with a new project, I finally hit upon changing the PK to an auto increment field and that fixed it. Is this is known issue?

Sergey Kornilov admin 6/22/2016

You do not normally edit primary keys. Primary keys must be unique and autonumber/autoincerment is the best choice. Foreign key is a different story and should be a separate field from primary key.