I want to change some string field in sdegeodatabse with bellow code. The code are running without any problem. but after running, filed length return to default length. What am i missing?
static void writetablecode(IDataset dataset)
{
ITable table = dataset as ITable;
IFieldsEdit fields = table.Fields as IFieldsEdit;
for (int i = 0; i < fields.FieldCount; i++)
{
IFieldEdit field = fields.Field[i] as IFieldEdit;
if (field.Type==esriFieldType.esriFieldTypeString & field.Length<30 )
{
field.Length_2 = 30;
}
}
}
It is not possible to edit the length of a field, the only way to achieve this is to create a new field, copy the data to the new field. http://support.esri.com/de/knowledgebase/techarticles/detail/42783
IFieldEdit shouldn't be used to change existing fields anyway. From the API reference: