5

I'm developping an ArcMap Extension and I need to join an existing feature class with data from a sql query located on another DBMS.

I already set up a Workspace with an OleDbWorkspaceFactory. I'm even able to add to the document any table contained in this database. I'm now trying to add a sql query to the document the same way I do it with tables. The query can be complex and include a couple of table with inner/left joins.

I looked in the ESRI documentation and I can't find the good object to do this.

Thanks

  • 1
    Have you tried the Make Query Table tool? – Kirk Kuykendall Feb 21 '13 at 19:07
  • I really need to be able to put a full sql statement ("Select ... from ... inner join ... where ..."), like when I define a new query layer in ArcMap – Goldorak84 Feb 21 '13 at 19:33
  • Are you saying you want to automate the process of doing File>Add Data>Add Query Layer... in arcmap? – Kirk Kuykendall Feb 21 '13 at 19:46
  • 2
    Did you check to see if ISqlWorkspace.OpenQuery returns a featureclass when the query includes a geometry column? – Kirk Kuykendall Feb 21 '13 at 20:06
  • 1
    I could always dynamically create the view (with the "CREATE VIEW" sql statement) and do an OpenTable on the view. – Goldorak84 Feb 21 '13 at 20:39
0

After multiple tests, since my requirement is to use an OleDbWorkspaceFactory, It's impossible to add to the document the results from a query. The only way to add these results it to create a view from the query (CREATE VIEW statement) and then do an OpenTable on the view

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.