I'm trying to add fields ussing this code:
GeoProcessor GP = new GeoProcessor();
GP.AddToolbox("C:/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx");
GP.SetEnvironmentValue("workspece", pWorkSpace.PathName.ToString()); // 1
// Generate the array of parameters.
IVariantArray parameters = new VarArrayClass();
for (int f = 0; f < newFields.Count; f++)
{
parameters.RemoveAll();
parameters.Add(@"D:\SaltLakeCity_Sts.shp");
string fieldName = "FIELD_" + f;
parameters.Add(fieldName);
parameters.Add("TEXT");
GP.Execute("AddField_management", parameters, null); // 2
}
I was getting this error after executing or attempting to execute line // 2
Error HRESULT E_FAIL has been returned from a call to a COM component. ESRI.ARCGIS.Geoprocessing
when adding line // 1 to try to solve the problem, I got the same error message when the program tried to execute line // 1
Any ideas? I have not used the geoprocessor with arcobjects before (this is the first time).
Thanks in advance for any help.
Luis F. Penedo