ArcObjects Library Reference (GeoDatabase)  

IClass.AddField Method

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

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned

FDO_E_TABLE_DUPLICATE_COLUMN:

FDO_E_NO_SCHEMA_LICENSE:

Functional License Check

If your application/site is not appropriately licensed, AddField can return an error of FDO_E_NO_SCHEMA_LICENSE.

Remarks

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.

See Also

IClass Interface