ArcObjects Library Reference  (GeoDatabase)    

IClass.AddField Method

Adds a field to this object class.

[Visual Basic 6.0]
Sub AddField(
    ByVal Field As IField _
[Visual Basic .NET]
Public Sub AddField ( _
    ByVal Field As IField _
public void AddField (
    IField Field
public void addField (
    IField Field
  IField* Field


Field [in]

  Field is a parameter of type IField

Product Availability

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

Errors Returned


A field with the specified name already exists in the table.


You are not licensed to modify the schema of the feature class.  This error can arise with an ArcView license when a field is added to a feature class that participates in a geometric network, topology or composite relationship class (such as feature-linked annotation)

Functional License Check

If your application/site is not appropriately licensed, AddField can return an Err.Number 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.

See Also

IClass Interface