locked
Cannot generate INSERT, UPDATE, DELETE in SQLDataSource RRS feed

  • Question

  • User1853794821 posted

    Tried to set up a datasource to support an editable gridview on a very simple table in a design I inherited.  The checkbox on the SqlDataSource wizard where you choose to generaqte INSERT, UPDATE, DELETE logic was greyed out.  All I could do was SELECT.

    After banging my head on the table for several hours, I finaloly discoovered why:  the "design" had no primary key declared on the table in question.  Once I gave it a primary key, the checkbox was enabled and I was back to getting some work done!

     

    Moral of the story:  ALWAYS have a primary key in your tables.

     

    Saturday, August 12, 2006 9:10 PM

All replies

  • User466404563 posted

    I have the same problem with the greyed out selection of INSERT, UPDATE, DELETE methods while creating a DATASET. I do have a primary key!

    I'm joining two tables (1st table)content PK and (2nd table)content FK. I was able to generate FILL and RETURN DATATable but unable to select the greyed out selection of insert, update and delete methods.

    I tried adding a PK in the 2nd table but same thing happen.

    Appreciate advice. Anyone

    Sunday, September 3, 2006 8:02 PM
  • User1853794821 posted
    Were you trying to update/insert based on a JOIN query?  If so, try instead using subqueries vs. JOINs.  I beloieve the wizards have some difficulty in determining the updateability of a JOIN-based datasource
    Tuesday, September 5, 2006 1:02 PM
  • User1416329745 posted

    Were you trying to update/insert based on a JOIN query?  If so, try instead using subqueries vs. JOINs.  I beloieve the wizards have some difficulty in determining the updateability of a JOIN-based datasource

    It is not the wizard JOIN in ANSI SQL is part of Algebra Idempotent Law where the data cannot be changed through a JOIN operation and yes Subquery is the correct thing to use because they are like JOIN but updatable.  SQL Server T-SQL can let you update JOIN so if you must update JOIN then use stored proc and in SQL Server 2005 be careful with your JOIN updates SQL Server may reject it because it is very ANSI SQL compliant.  Hope this helps.

    Tuesday, September 5, 2006 1:15 PM
  • User-1772261659 posted

    For some reason INSERT is not getting displayed even though I selected INSERT,UPDATE AND DELETE.

    Can you give me some idea?

    thanks[:)]

    Monday, December 3, 2007 5:14 PM
  • User-359936451 posted

    Try using a DataList instead of Gridview.

    Monday, October 15, 2012 10:29 AM
  • User-264344540 posted

    I was wondering what can we do, in case we encounter the same problem with Views as the DataSource. The same scenario is coming up for me. Can you suggest something?

    Friday, March 29, 2019 5:53 AM