Column Id error

May 6, 2010 at 10:53 AM

why is it i cant add a value to my id, i change my id in db with varchar(50) so that i can put manually a value on the fields
but is gives me this error 

Error 6 Property or indexer 'MyItSide.Store.Business.Objects.Order.Id' cannot be assigned to -- it is read only C:\My Dropbox\Working\Store - 2010\MyITside.Store.Web\ProdDetails.aspx.cs 50 21 MyITside.Store.Web

 

Coordinator
May 6, 2010 at 12:54 PM

Primary keys of an object are read-only. You can explicitly set them on in the object creation. Look at at the parent collections's NewItem method. There is an overload for primary key. Once an object is created, you can no longer change it.