ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMSqlQueryDataConnection Class
Members Example

In This Topic
    CIMSqlQueryDataConnection Class
    In This Topic
    Represents a SQL query data connection.
    Object Model
    CIMSqlQueryDataConnection ClassCIMSqlQueryDataConnection ClassEnvelope ClassCIMSqlQueryDataConnection ClassCIMMaterializedViewProperties ClassSpatialReference Class
    Syntax
    Example
    Create a query layer
    await QueuedTask.Run(() =>
    {
      Map map = MapView.Active.Map;
      Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(@"C:\Connections\mySDE.sde")));
      CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
      {
        WorkspaceConnectionString = geodatabase.GetConnectionString(),
        GeometryType = esriGeometryType.esriGeometryPolygon,
        OIDFields = "OBJECTID",
        Srid = "102008",
        SqlQuery = "select * from MySDE.dbo.STATES",
        Dataset = "States"
      };
      var lcp = new LayerCreationParams(sqldc)
      {
        Name = "States"
      };
      FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map);
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMDataConnection
             ArcGIS.Core.CIM.CIMSqlQueryDataConnection

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also