Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling Identities
Message
De
13/03/2010 08:12:11
 
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01454212
Message ID:
01454290
Vues:
41
Hi Naomi,

I understand that, but this is a MM.NET question as to why the below code was generated.

>You can not set identity field (it's generated automatically by SQL Server).
>
>Only if you have SET IDENTITY_INSERT ON for the table you would be able to update identity field.
>
>>Hi,
>>
>>I have changed a varchar column to a smallint identity column, regenerated using the Business Layer Generator, but when I run my application I get this error:
>>
>>Column 'AgentNumber' is read only.
>>
>>in my AgentEntity class on this code:
>>
>>
>>		public Int16 AgentNumber
>>		{
>>			get
>>			{
>>				if (this.Row != null)
>>					return (Int16)mmType.GetNonNullableDbValue(this.Row["AgentNumber"], "System.Int16");
>>				else
>>					return this._agentNumber;
>>			}
>>			set
>>			{
>>				if (this.Row != null)
>>					this.Row["AgentNumber"] = value; 
>>				this._agentNumber = value;
>>				this.OnPropertyChanged(new PropertyChangedEventArgs("AgentNumber"));
>>			}
>>		}
>>		private Int16 _agentNumber;
>>
>>The error occurs on this.Row["AgentNumber"] = value;
>>
>>What have I done wrong/missed out here?
>>.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform