Identity property doesn't autopopulate fields RRS feed

  • Question

  • User500063647 posted

    Hi, everyone.  I just started with WebMatrix and followed the tutorial examples.  I used the UI to create a table (Movies).  I set the following columns:

    ID int primary key identity not null 

    Title nvarchar(50) not null

    Genre nvarchar(30) not null

    Year nchar(4) not null

    I also created the table through the query window:

    CREATE TABLE Movies 
       Title NVARCHAR(50) NOT NULL,
       Genre NVARCHAR(30) NOT NULL,
       Year NCHAR(4) NOT NULL

    But when I tried to enter the following data:

    Title = Ironman 3, Genre = Action, Year = 2013

    The following warning pops up:

    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 =

    For some reason the Is Identiy not working either by creating the table by UI or by query window.
    It doesn't let me insert a value on ID and it isn't auto generating the number.  Any help would be appreciated.

    Friday, May 31, 2013 1:38 PM


All replies

  • User-851967432 posted

    You can't insert into the ID column because it's an autogenerated Identity column. If you want to insert, make sure you're not including that column any where in your query. It's not designed to be inserted into. It's autogenerated to guarantee uniqueness.

    Friday, May 31, 2013 1:51 PM
  • User-821857111 posted

    There's a bug in the database tools in WebMatrix 3. You are better off uninstalling it and then installing WebMatrix 2: http://www.microsoft.com/Web/webmatrix/v2/

    Friday, May 31, 2013 2:07 PM
  • User500063647 posted

    Thank for your reply Mike.  I tried downloading from that link but it doesn't get installed.  The following message displays after trying to intall it:

    Microsoft Web Platform Installer couldn't find the product you tried to install.  Either the link you clicked is incorrect or you may be overriding your feed with a different feed: To learn more about customs feeds and how to reset Microsoft Web Platform Installer, click here.

    That link takes me to the Webmatrix 3 download page.  If in that page I click the link for WebMatrix 2, it brings the same page you linked me.  Im not sure but apparently the setup of Webmatrix 2 doesn't work well for Windows 7 and up.  The downloaded setup is called WebMatrix2forVistaOrBelow.exe.  Is there any other way to install WebMatrix 2? 

    Friday, May 31, 2013 3:21 PM
  • User-821857111 posted

    You should take your question to the WebMatrix forum at http://forums.iis.net/1166.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 1, 2013 2:54 AM