Help with IBasicGeoprocessor.Merge

Discussion created by SnoBrdinRTiste on May 21, 2012
Latest reply on May 21, 2012 by SnoBrdinRTiste
I have managed to merge all the layers (with the same table attributes) into one single shapefile.  However, the table structure is not the same as the original.  For instance, my layers in the map control have fields named "Contact", "Address", "Location", "Phone" and the merged shapefile has a table with fields: "field_1", "field_2", "field_3", etc
Worse, there isn't even any data in any of the fields...
What am I doing wrong?

            ITable inputTable = null;                        
            // Create a feature class name for the output shapefile and open the output's workspace
            IWorkspaceName pWorkspaceName = new WorkspaceNameClass();
            pWorkspaceName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory.1";
            pWorkspaceName.PathName = @"C:\Temp";

            // define the temp output featureclass name
            IFeatureClassName pFeatClassName = new FeatureClassNameClass();
            pFeatClassName.FeatureType = esriFeatureType.esriFTSimple;
            pFeatClassName.ShapeFieldName = "Shape";
            pFeatClassName.ShapeType = esriGeometryType.esriGeometryPolygon;
            IDatasetName pDatasetName = (IDatasetName)pFeatClassName;
            pDatasetName.Name = "Merge_Result"; 
            pDatasetName.WorkspaceName = pWorkspaceName;

            IArray featArray = new ArrayClass();
            ILayer pLayer;
            for (int i = 0; i < axMapControl1.LayerCount; i++)
                pLayer = (ILayer)axMapControl1.get_Layer(i);          
                inputTable = (ITable)pLayer;

            // perform the merge
            IBasicGeoprocessor pBGP = new BasicGeoprocessorClass();
                IFeatureClass pOutFeatureClass = pBGP.Merge(featArray, inputTable, pFeatClassName);
            catch (Exception ex)