This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IC > IClass Interface > IClass.AddField Method (ArcObjects .NET 10.5 SDK) |
Adds a field to this object class.
[Visual Basic .NET] Public Sub AddField ( _ ByVal Field As IField _ )
[C#] public void AddField ( IField Field );
[C++]
HRESULT AddField(
IField* Field
);
[C++]
Parameters Field [in]
Field is a parameter of type IField
FDO_E_TABLE_DUPLICATE_COLUMN:
FDO_E_NO_SCHEMA_LICENSE:
If your application/site is not appropriately licensed, AddField can return an error of FDO_E_NO_SCHEMA_LICENSE.
Prior to adding a new field to a class, an exclusive schema lock should be obtained using the ISchemaLock interface.
Attempting to add a new field that does not allow null values will fail, if the class already has data in it. The only solution is to recreate the class with the non-nullable field, then copy the rows from the original class into the new class.