Query support unavailable. (Error 3389)

You attempted to establish referential integrity on a CdbRelation object of a CdbQueryDef object, which is not supported.

Change the Attributes property setting of the CdbRelation object to dbRelationDontEnforce.