The field 'ProductId' is read-only and can't be changed.

Posts   
 
    
dcarlile
User
Posts: 11
Joined: 09-Nov-2006
# Posted on: 02-May-2007 17:11:06   

I get this error when trying to save a value to the entity item 'ProductId'.

THE FOLLOWING CODE EXECUTES WITH NO ERROR..... ProductionRequestItemEntity item = new ProductionRequestItemEntity(); item.StudentName = txtStudentNameItem.Text.ToString(); item.CameraCard = txtCameraCard.Text.ToString(); item.JobId = Convert.ToInt32(txtJobId.Text.ToString()); item.Quantity = Convert.ToInt16(txtQuantity.Value); item.UpdatedBy = Common.UserInfo.Username; item.PackageProductId = Convert.ToInt32(drpProduct.ActiveRow.Cells["Id"].Value);

THIS NEXT LINE OF CODE YIELDS THE ERROR The field 'ProductId' is read-only and can't be changed.

item.ProductId = Convert.ToInt32(drpProduct.ActiveRow.Cells["Id"].Value);

What is it that could cause this error?

Thanks, Dan

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-May-2007 17:15:24   

ProductId is generated as a ReadOnly field in the code, is it defined as an Identity Field in this entity (in the LLBLGen Pro Designer)?

dcarlile
User
Posts: 11
Joined: 09-Nov-2006
# Posted on: 02-May-2007 17:31:28   

I checked in the Designer. Right-clicked the entity item. Went into the Edit/Properites window. And YES the 'ProductId' field was checked 'Read-only'. Don't remember ever checking it, but never the less it was checked. Thanks for your quick support. Dan