locked
Why the Advanced Insert/Update/Delete statement for a SQL DataSource can not be generated? RRS feed

  • Question

  • User-830563764 posted

    When configuring a SqlDataSource control in an ASP.NET webpage, after creating a Connection string, on the "Configure the Select Statement"
    page, with a database table selected and columns clicked, clicking the Advanced button did not display the boxes for generating the 'Additional
    INSERT, UPDATE, and DELETE statements.  Why?

    I have had this problem before and the problems seemed to related to the creating a Primary Key of table.  However, working a new website,
    I found out I had no problem with a table without a PK, while for a table with a PK, the Advanced Insert/Update/Delete statement can not be
    generated. Why?

    Thanks in advance,
    Jeffrey

    Tuesday, March 29, 2016 8:13 PM

Answers

  • User-821857111 posted

    You need to make sure that the PK is part of the SELECT statement. Then the other operations should become available.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 30, 2016 7:08 AM
  • User1559292362 posted

    Hi wonjartran,

    When configuring a SqlDataSource control in an ASP.NET webpage, after creating a Connection string, on the "Configure the Select Statement"
    page, with a database table selected and columns clicked, clicking the Advanced button did not display the boxes for generating the 'Additional
    INSERT, UPDATE, and DELETE statements.  Why?

    According to your description, do you mean that vs couldn’t display the boxes for generating the 'Additional
    INSERT, UPDATE, and DELETE statements' when the table with a primary key? If so, I create a demo which has a table with primary key, and I don’t encounter the issue what you occurring.

    Firstly, I select some field without primary key. The option is disabled.

    Secondly, as it said, you must have all primary key fields selected for this option to enabled, I select the primary key field, it’s to be enabled.

    I have had this problem before and the problems seemed to related to the creating a Primary Key of table.  However, working a new website,
    I found out I had no problem with a table without a PK, while for a table with a PK, the Advanced Insert/Update/Delete statement can not be
    generated. Why?

    Thirdly, I create a table without primary key. It’s disabled whatever I select any field.

    Best regards,

    Cole Wu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 30, 2016 7:08 AM

All replies

  • User-821857111 posted

    You need to make sure that the PK is part of the SELECT statement. Then the other operations should become available.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 30, 2016 7:08 AM
  • User1559292362 posted

    Hi wonjartran,

    When configuring a SqlDataSource control in an ASP.NET webpage, after creating a Connection string, on the "Configure the Select Statement"
    page, with a database table selected and columns clicked, clicking the Advanced button did not display the boxes for generating the 'Additional
    INSERT, UPDATE, and DELETE statements.  Why?

    According to your description, do you mean that vs couldn’t display the boxes for generating the 'Additional
    INSERT, UPDATE, and DELETE statements' when the table with a primary key? If so, I create a demo which has a table with primary key, and I don’t encounter the issue what you occurring.

    Firstly, I select some field without primary key. The option is disabled.

    Secondly, as it said, you must have all primary key fields selected for this option to enabled, I select the primary key field, it’s to be enabled.

    I have had this problem before and the problems seemed to related to the creating a Primary Key of table.  However, working a new website,
    I found out I had no problem with a table without a PK, while for a table with a PK, the Advanced Insert/Update/Delete statement can not be
    generated. Why?

    Thirdly, I create a table without primary key. It’s disabled whatever I select any field.

    Best regards,

    Cole Wu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 30, 2016 7:08 AM