PGDB Error Loading Records

754
2
05-23-2011 08:04 AM
JamesCrandall
MVP Frequent Contributor
ArcGIS10 / Personal Geodatabase / Table and FeatureClasses

I am having some difficulty determining and finding a suitable remedy for a reocurring error.  I have developed some customized ArcObjects that populates an ITable, then joins(IMemoryRelationshipClassFactory) this with another layer in the PGDB.  Actually, there are no errors during this entire process and everything renders perfectly.

The error comes when attempting to open the attribute table of the layer (after the join is complete).  This is the exact error message in this format (multi-line message):

There was an error loading records
The spatial index grid size is invalid [OID Table0]
The spatial index grid size is invalid

That it's -- those 3 lines appear and the attribute table is blank.  However, if I remove the Join manually, then there is no error opening the attribute table!

Any help is appreciated.

james
0 Kudos
2 Replies
JamesCrandall
MVP Frequent Contributor
In addition:

When an Identify is performed on a feature, the information is all there (including any joined field information) and there is no such error.  The error only occurs when attempting to open the attribute table of the Layer.  Alternatively, if I attempt to perform a SelectByAttributes on the attribute table, it cannot load any of the fields and therfore cannot query anything with the Querybuilder UI.

Also: I cannot make any selections at all with the SelectFeature tool.

Also2: When I export the layer to a shapefile, it keeps all of the joined fields and contains the correct values.

I am not having much luck locating anyone/thread/post with this similar behavior.  I've read thru a couple of items that suggest re-creating the layer and re-setting the Shape index value, then appending the data from the original layer, but this does nothing to alleviate the error.
0 Kudos
JamesCrandall
MVP Frequent Contributor
Ok, I found the problem was with the way I was setting up my IRelationshipClass.  I don't remember exactly where I found the example in setting this up, but I was not explicitly stating the Cardinality (for some reason I was using 0, but it did not error, so I believed this was working ok).  Anyway this is what you should not do:

pRelationshipClass = pMemoryRelationshipClassFactory.Open("Join", pTable, sTableField, pFeatureLayer.DisplayFeatureClass, sLayerField, "forward", "backward", 0)


You should explicitly state the Cardinality like so:

pRelationshipClass = pMemoryRelationshipClassFactory.Open("Join", pTable, sTableField, pFeatureLayer.DisplayFeatureClass, sLayerField, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne)
0 Kudos