1

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

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 18, 2018 at 17:24
1
  • Comments are not for extended discussion; this conversation has been moved to chat. Commented Jun 18, 2018 at 21:42

1 Answer 1

6

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

answered Jun 18, 2018 at 17:34
1
  • Thanks bro. It worked like a charm. Did you check the answer i posted for a question that we were trying to solve. [link]gis.stackexchange.com/questions/286127/… Commented Jun 18, 2018 at 17:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.