locked
Newbie problem - Adding data to table RRS feed

  • Question

  • User-1083750537 posted

    I have a problem when learning tutorial at:

    http://www.asp.net/web-pages/tutorials/introducing-aspnet-web-pages-2/displaying-data

    part - Adding Some Example Data

    I tried add some data in first row but it appearred error:

    "Invalid data

    Your change could not be committed to the database.
    After you click OK you can fix the invalid entry or press the Esc key to cancel your changes.

    The column cannot be modified. [ Column name = ID ]"

    Can anyone help me?

    My English writing skill is so bad! :-((

    Thursday, June 13, 2013 12:37 PM

Answers

  • User-821857111 posted

    There is a bug in WebMatrix 3 which doesn't allow you to add data to a table through the Database interface as described in the tutorial. You can instead click in on the Home tab and then click New Query. Then add the following and press Execute:

    INSERT INTO Movies (Title, Genre, Year) VALUES ('When Harry Met Sally', 'Romantic Comedy', '1989')

    Change the values to add additional rows of data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 13, 2013 3:20 PM

All replies

  • User540310021 posted

    Hi Dear,

    IsIndentity has to be true for the ID Column so that it gets auto incremented everytime.

    Thursday, June 13, 2013 12:41 PM
  • User-1083750537 posted

    I didn't modify the ID column, I tried do conform to tutorial:

    Click the Title column and enter "When Harry Met Sally". Move to the Genre column (you can use the Tab key) and enter "Romantic Comedy". Move to the Year column and enter "1989":

    Database entry grid in WebMatrix with one record

    Press Enter then error occurred.

    Thursday, June 13, 2013 1:02 PM
  • User-352524747 posted
    Are you using Webmatrix 3?
    Thursday, June 13, 2013 2:50 PM
  • User-821857111 posted

    There is a bug in WebMatrix 3 which doesn't allow you to add data to a table through the Database interface as described in the tutorial. You can instead click in on the Home tab and then click New Query. Then add the following and press Execute:

    INSERT INTO Movies (Title, Genre, Year) VALUES ('When Harry Met Sally', 'Romantic Comedy', '1989')

    Change the values to add additional rows of data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 13, 2013 3:20 PM
  • User-1083750537 posted

    Thanks Mikesdotnetting!

    Thursday, June 13, 2013 8:56 PM