I want to edit data in database but if I tried to edit any value in a row, an error message
Cannot update identity column 'ProductID'
appeared after trying to update the data. I'm just a beginner, so I have no idea where the bug is.
<asp:SqlDataSource ID="Adventure" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStrAdventure %>"
DeleteCommand="DELETE FROM [Production].[Product] WHERE [ProductID] = @ProductID"
InsertCommand="INSERT INTO [Production].[Product] ([ProductID], [Name], [ProductNumber], [MakeFlag], [FinishedGoodFlag], [Color], [SafetyStockLevel], [ReorderPoint], [StandardCost], [ListPrice], [Size], [SizeUnitMeasureCode], [WeightUnitMeasureCode], [Weight], [DaysToManufacture], [ProductLine], [Class], [Style], [ProductSubcategoryID], [ProductModelID], [SellStartDate], [SellEndDate], [DiscontinuedDate], [rowguid], [ModifiedDate]) VALUES (@ProductID, @Name, @ProductNumber, @MakeFlag, @FinishedGoodFlag, @Color, @SafetyStockLevel, @ReorderPoint, @StandardCost, @ListPrice, @Size, @SizeUnitMeasureCode, @WeightUnitMeasureCode, @Weight, @DaysToManufacture, @ProductLine, @Class, @Style, @ProductSubcategoryID, @ProductModelID, @SellStartDate, @SellEndDate, @DiscontinuedDate, @rowguid, @ModifiedDate) " SelectCommand="SELECT * FROM [Production].[Product]"
UpdateCommand="UPDATE [Production].[Product] SET [ProductID] = @ProductID,[Name] = @Name, [ProductNumber] = @ProductNumber, [MakeFlag] = @MakeFlag, [FinishedGoodsFlag] = @FinishedGoodsFlag, [Color] = @Color, [SafetyStockLevel] = @SafetyStockLevel, [ReorderPoint] = @ReorderPoint, [StandardCost] = @StandardCost, [ListPrice] = @ListPrice, [Size] = @Size, [SizeUnitMeasureCode] = @SizeUnitMeasureCode, [WeightUnitMeasureCode] = @WeightUnitMeasureCode, [Weight] = @Weight, [DaysToManufacture] = @DaysToManufacture, [ProductLine] = @ProductLine, [Class] = @Class, [Style] = @Style, [ProductSubcategoryID] = @ProductSubcategoryID, [ProductModelID] = @ProductModelID, [SellStartDate] = @SellStartDate, [SellEndDate] = @SellEndDate, [DiscontinuedDate] = @DiscontinuedDate, [rowguid] = @rowguid, [ModifiedDate] = @ModifiedDate WHERE [ProductID] = @ProductID">
The second part of the code here as image.
Thank you in advance for any ideas.