Select to view content in your preferred language

Query hosted feature layer from ArcGIS Pro Add-In

89
1
Tuesday
BryanLynn1
Occasional Contributor

I am using ArcGIS Pro 3.5.3 and hitting ArcGIS Enterprise 11.5 portal. I can find the item in the portal but I can't figure out how to query it.  I have tried:

using (Geodatabase gdb = new Geodatabase(new ServiceConnectionProperties(new Uri($"{_portalLayer.Url}/0"))))
{                       
    string whereClause = $"OBJECTID = {SelectedIntersection.ObjectId}";

    QueryDef qf = new QueryDef
    {
        Tables = _intersectionPtFC,
        WhereClause = whereClause
    };

    using (RowCursor rowCursor = gdb.Evaluate(qf))
    {
        while (rowCursor.MoveNext())
        {
            using (Row row = rowCursor.Current)
            {
                Feature thePoint = null;
                thePoint = row as Feature;

                System.Diagnostics.Debug.Print(row["INTERESCTION_NAME"].ToString());

                locationPoint = thePoint.GetShape() as MapPoint;
            }
        }
    }
}
0 Kudos
1 Reply
MichaelKohler
Frequent Contributor

Just a quick glance, maybe get the table itself and run the query against that. I'm not too familiar with the Execute statement on the gdb.

this is from the docs at https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14110.html

using (RowCursor rowCursor = geodatabase.Evaluate(adaCompilantParksQueryDef, false))

  you are missing the recycle parameter

0 Kudos