As shown in the image below, I need to fetch query mentioned within query section of a layer using ArcObjects in C#.

            IDocument doc = ArcMap.Application.Document;
            IMxDocument mxDoc = doc as IMxDocument;
            IMap map = mxDoc.FocusMap;
            ILayer mapLayer = map.get_Layer(0);
            IFeatureClass c = (mapLayer as IFeatureLayer).FeatureClass;

enter image description here

  • Comments are not for extended discussion; this conversation has been moved to chat. – Mapperz Jun 18 '18 at 21:42

Cast the layer to an IDatalayer2. Cast IDataLayer2.DataSourceName to IQueryTableName Get the SQL from IQueryTableName.Query


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.