Problems with IDENTITY_INSERT Set to OFF? :-/

后端 未结 6 834
情深已故
情深已故 2020-12-14 13:49

I\'m trying to insert order details into my DB, and it keeps saying:

Cannot insert explicit value for identity column in table \'Orders\' when IDENTIT

6条回答
  •  眼角桃花
    2020-12-14 14:37

    You have set IS Identity to YES that's why now you cant insert value for this column DB will automatically insert it by incrementing values..

    And the thing i am seeing you set UserId as the primary key of the table which is wrong Order OoderID should be the primary key of the column.

    Set UserID IsIdentify to false and OrderID IsEdentitfy to yes and made it primary key column.

提交回复
热议问题