Hi! I'm using a queryDef to join two featurceclasses and built a new featureclass. Later this new featureclass is seleted by queryfilter and the selectionset is used to make a featureselection. So I can select all objects from featureclass1 that are joined with feaureclass2. With MDB everything works fine. Now I have to use SDE-FeatureClasses in an version an I get an HRESUL-Error. But I don't know why. I already put the dbname and owner (qualifier) in front of the fc-names.
Here's my code:
IQueryDef queryDef = ws.CreateQueryDef();
//Setting the SubFields, Tables, and WhereClause: //Single table with a WhereClause queryDef.Tables = "dbname.dbowner.ele_kv, dbname.dbowner.ele_stat"; queryDef.SubFields = "dbname.dbowner.ele_kv.shape, dbname.dbowner.ele_kv.objectid, dbname.dbowner.ele_kv.stat_ref, dbname.dbowner.ele_stat.objectid"); queryDef.WhereClause = "dbname.dbowner.ele_kv.stat_ref = dbname.dbowner.ele_stat.objectid";
//Abfrage als FeatureClass erzeugen FeatureQueryNameClass qfcBM = new FeatureQueryNameClass(); qfcBM.WorkspaceName = ((IDataset)ws).FullName as IWorkspaceName; qfcBM.QueryDef = queryDef; qfcBM.PrimaryKey = dbname.dbowner.ele_kv.objectid; qfcBM.ShapeFieldName = dbname.dbowner.ele_kv.shape; qfcBM.Name = "QRY_KV"; qfcBM.CopyLocally = true;
//DOESN'T WORK!! IFeatureClass fcQuery = qfcBM.Open() as IFeatureClass;