locked
Error saving updates on a screen made using a view in MS SQL database RRS feed

  • Question

  • Hey. I imported a view into my lightswitch project that only returns the set of unapproved records in one table.  The view was used to create a screen for the project.

    I added some code that allow multiple selections of rows in the data grid.  After checking a condition all selected records will have an empty column updated to approved or unapproved.  I can see the approved or unapproved status being updated on the screen, but the save keeps failing.  

    Is it possible to do such an update and save data back to the source table from a table that is a view?


    Friday, October 17, 2014 2:35 AM

All replies

  • Hi,

    SQL views can be modified only if they meet certain conditions, which are defined in the “Updatable Views” section of the article CREATE VIEW (Transact-SQL). LightSwitch entities that represent views aren’t editable by default. If you determine that a view meets the updatability conditions listed in that article, you can enable the Is Editable property for the entity. Here is LightSwitch team blog for you, see: Attaching to SQL Views

    Please let me know if there is anything that I can do to help.

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 20, 2014 11:15 AM
  • Hey. I would see the queries in sql profiler. However it can reveal bugs/inconsistences like this:

    https://social.msdn.microsoft.com/Forums/en-US/ec37b550-43c2-4bae-a4d1-f436497251c3/inserting-to-views-how-to-select-fields-to-insert?forum=lightswitch


    Sergey Vdovin

    Monday, October 20, 2014 12:11 PM
  • Thank you Angie.  The article was indeed helpful but I could not see the 'is editable' property when I opened the view entity. The 'is searchable' property is there, but not the editable.  Do you have any idea why I am not seeing that? 
    Monday, October 20, 2014 12:28 PM