locked
Add Button disabled when attaching External Database table with string Primary Keys RRS feed

  • Question

  • Hello I have attached external Database with one table having string as Primary key.
    Lightswith has disabled Add,Edit and delete buttons  for this table .

    Is it possible to work with string Primary Keys with Lightswitch ?

     

    Monday, June 30, 2014 2:56 AM

Answers

  • LightSwitch doesn't like using Strings as the Primary Key (PK) for a table. The only time I've used it is for a list of Countries using the ISO Country Code (char(2)) and those are virtually fixed so no need to add records. 

    LightSwitch will cope with GUID as PK but much prefers Int Identity PKs.

    Is it possible to add an Int Identity column to your table and use that as PK, perhaps keeping the original PK column as a secondary unique key?


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    • Marked as answer by Muhsin Awadhi Monday, June 30, 2014 11:25 AM
    Monday, June 30, 2014 8:33 AM

All replies

  • LightSwitch doesn't like using Strings as the Primary Key (PK) for a table. The only time I've used it is for a list of Countries using the ISO Country Code (char(2)) and those are virtually fixed so no need to add records. 

    LightSwitch will cope with GUID as PK but much prefers Int Identity PKs.

    Is it possible to add an Int Identity column to your table and use that as PK, perhaps keeping the original PK column as a secondary unique key?


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    • Marked as answer by Muhsin Awadhi Monday, June 30, 2014 11:25 AM
    Monday, June 30, 2014 8:33 AM
  • Hello Simon,
    I do not have direct access to this database...
    i will try to convince database owner to add integer identity column

    Thanks 

    Monday, June 30, 2014 11:25 AM