Deletes a field from this object class.
[Visual Basic .NET] Public Sub DeleteField ( _ ByVal Field As IField _ )
[C#] public void DeleteField ( IField Field );
[C++]
HRESULT DeleteField(
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_FIELD_CANNOT_DELETE_WEIGHT_FIELD:
- Cannot delete a field that corresponds to an existing weight in a geometric network.
FDO_E_FIELD_CANNOT_DELETE_REQUIRED_FIELD:
- Cannot delete a required field. For a list of required fields, see the Remarks section. If the field was set as required by the user, (check the IField::Required property and is not one of the fields listed under remarks), the IFieldEdit::Required property can be used to remove the required status, then the field can be deleted.
FDO_E_NO_SCHEMA_LICENSE:
- You are not licensed to modify the schema of the feature class. This error can arise with an ArcGIS for Desktop Basic 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).
FDO_E_SE_DBMS_DOES_NOT_SUPPORT:
- Cannot delete a field from DB2.
Remarks
DeleteField removes the specified field from a table, object class or feature class. Fields that are required by the Geodatabase and cannot be removed include:
- OBJECTID field
- SHAPE and shape dependent fields such as SHAPE_Length
- Enabled, AncillaryRole and Weight field for network feature classes
- Subtype fields. In order to delete a subtype field, it must first be removed as the subtype field, see the help on ISubtypes::SubtypeFieldName
Prior to deleting a field from a class, an exclusive schema lock should be obtained using the ISchemaLock interface.