<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to open a cursor based on a query (not QueryDef)? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-open-a-cursor-based-on-a-query-not-querydef/m-p/1172876#M8123</link>
    <description>&lt;P&gt;Found a solution based on the Database class instead of Geodatabase:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var query = string.Format("select cast(forstgis.wimsidutil.nextwimsid({0}) " +
    "as number(38,0)) id from dual", unitId);
using (var queryDesc = database.GetQueryDescription(query, "QueryLayer"))
{
    queryDesc.SetObjectIDFields("id");
    using (var table = database.OpenTable(queryDesc))
    using (var cursor = table.Search())
    {
        while (cursor.MoveNext())
        {
            using (var row = cursor.Current)
            {
                return (int)row[0];
            }
        }
    }
}&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 11 May 2022 15:40:16 GMT</pubDate>
    <dc:creator>FridjofSchmidt</dc:creator>
    <dc:date>2022-05-11T15:40:16Z</dc:date>
    <item>
      <title>How to open a cursor based on a query (not QueryDef)?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-open-a-cursor-based-on-a-query-not-querydef/m-p/1167080#M8058</link>
      <description>&lt;P&gt;In ArcObjects it is possible to return a cursor based on a query string with ISqlWorkspace.OpenQueryCursor(myQuery). I was wondering if and how this is possible in the ArcGIS Pro SDK.&lt;/P&gt;&lt;P&gt;The query is in fact calling an Oracle stored procedure which returns a number based on an input number:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var myQuery = string.Format("select forstgis.wimsidutil.nextwimsid({0}) from dual", unitId);&lt;/LI-CODE&gt;&lt;P&gt;I tried to put this into a QueryDef and use Geodatabase.Evaluate(queryDef) like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;            var queryDef = new QueryDef
            {
                Tables = "dual",
                SubFields = string.Format("forstgis.wimsidutil.nextwimsid({0})", unitId)
            };&lt;/LI-CODE&gt;&lt;P&gt;However, Evaluate in this case throws a COMException (HRESULT: 0x80040351).&lt;/P&gt;&lt;P&gt;I know there is also the ArcSDESQLExecute class, but I would prefer not to use Geoprocessing in this case.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 16:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-open-a-cursor-based-on-a-query-not-querydef/m-p/1167080#M8058</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2022-04-22T16:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to open a cursor based on a query (not QueryDef)?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-open-a-cursor-based-on-a-query-not-querydef/m-p/1172876#M8123</link>
      <description>&lt;P&gt;Found a solution based on the Database class instead of Geodatabase:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var query = string.Format("select cast(forstgis.wimsidutil.nextwimsid({0}) " +
    "as number(38,0)) id from dual", unitId);
using (var queryDesc = database.GetQueryDescription(query, "QueryLayer"))
{
    queryDesc.SetObjectIDFields("id");
    using (var table = database.OpenTable(queryDesc))
    using (var cursor = table.Search())
    {
        while (cursor.MoveNext())
        {
            using (var row = cursor.Current)
            {
                return (int)row[0];
            }
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 May 2022 15:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-open-a-cursor-based-on-a-query-not-querydef/m-p/1172876#M8123</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2022-05-11T15:40:16Z</dc:date>
    </item>
  </channel>
</rss>

