AnsweredAssumed Answered

Export Annotation features from ArcSDE to Personal Geodatabase Feature Class

Question asked by nikki_minton on May 22, 2014
Latest reply on May 22, 2014 by nikki_minton

I'm trying to export some annotation data out of ArcSDE into an annotation feature class in a personal geodatabase and I'm stuck. I've cloned the ArcSDE feature class to create a new feature class in the personal geodatabase and now I need to get the data into the new feature class so I'm trying to use an insert cursor but it throws an error on the following line

pFBuffer.Value(pFBuffer.Fields.FindField(i)) = pFeat.Value(pFeat.Fields.FindField(i))

the error I get states that 'the Index passed was not in the valid range'

If anyone has any ideas they would be much appreciated - or if I'm going about this in totally the wrong then suggestions for a better way would also be welcome.


The section of my code is below:-

If pFeatClass.FeatureType = esriFeatureType.esriFTAnnotation Then
                    'code to export annotation which needs to be handled differently

                    If OutputFeatureClassName = "MapFaceNote" Then
                        Call CloneAnnoFeatureClass(pFeatClass, MDBworkspace, OutputFeatureClassName)

                        pNewFeatClass = OpenFeatureClass(MDBworkspace, OutputFeatureClassName)

                        pFeatCursor = pFeatClass.Search(Nothing, False)

                        pFeat = pFeatCursor.NextFeature

                        Do Until pFeat Is Nothing
                            pInsertCursor = pNewFeatClass.Insert(True)
                            pFBuffer = pNewFeatClass.CreateFeatureBuffer

                            For i = 0 To pFBuffer.Fields.FieldCount - 1
                                If pFBuffer.Fields.Field(i).Editable Then
                                    pFBuffer.Value(pFBuffer.Fields.FindField(i)) = pFeat.Value(pFeat.Fields.FindField(i))
                                End If
                            Next i
                            pFeat = pFeatCursor.NextFeature

                    End If