<?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: SQL statements in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449545#M12207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this link answers your question that this is not currently possible:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/TklNMDY0NDcy"&gt;http://support.esri.com/en/bugs/nimbus/TklNMDY0NDcy&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any chance you could call this layer from an SDE geodatabase where ORDER BY is supported?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might try a personal geodatabase as it might also be supported there, but you would need to test that out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Nov 2012 15:06:04 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2012-11-16T15:06:04Z</dc:date>
    <item>
      <title>SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449540#M12202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm new to SQL statements and especially within ArcGIS. I'm programming an addin against a file geodatabase in in Desktop 10.1 and I'm getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SELECT FeatureClassAlias FROM tblFeatureClasses WHERE IsSearchable = 'Y' ORDER BY SortSequence]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works if I take out the ORDER BY SortSequence part, but it obviously doesn't sort at all. I've looked at all the ESRI references on SQL with File geodatabases and can't see my error. It says field names may be delimited by quotes, but that hasn't helped. It also says that ORDER BY won't work if I'm searching in all fields with SELECT *, but that shouldn't be my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SELECT "FeatureClassAlias" FROM tblFeatureClasses WHERE "IsSearchable" = 'Y' ORDER BY "SortSequence"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd greatly appreciate help with this issue from someone with SQL experience. I'll also post the code if you think it will help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cdebruin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; Public Sub LoadTblToCbx(inputTable As ITable, inputFieldName As String, cbxInput As System.Windows.Forms.ComboBox) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Create the query filter. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim queryFilter As IQueryFilter2 = New QueryFilter&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Select the fields to be returned &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilter.SubFields = inputFieldName&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Set the filter to return only searchable &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilter.WhereClause = """IsSearchable"" = 'Y'"&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Use the PostfixClause to sort ascending &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim queryFilterDef As IQueryFilterDefinition2 = CType(queryFilter, IQueryFilterDefinition2) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilterDef.PostfixClause = "ORDER BY ""SortSequence"""&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Output the returned feature class name. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim fieldIndex As Integer = inputTable.FindField(inputFieldName) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim cursor As ICursor = inputTable.Search(queryFilter, True) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim row As IRow = cursor.NextRow() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not row Is Nothing &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim field As String = Convert.ToString(row.Value(fieldIndex)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cbxInput.Items.Add(field) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.NextRow() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End While&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marshal.FinalReleaseComObject(cursor)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 12:05:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449540#M12202</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-11-16T12:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449541#M12203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this for additional information:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.esri.com/help/9.3/ArcGISEngine/arcobjects/esriGeoDatabase/IQueryFilterDefinition.PostfixClause_Example.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.esri.com/help/9.3/ArcGISEngine/arcobjects/esriGeoDatabase/IQueryFilterDefinition.PostfixClause_Example.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;[Visual Basic 6.0]'this is an example of using the PostfixClause property to append a Order By clause to the query
Dim pQueryFilter As IQueryFilterSet pQueryFilter = New QueryFilterpQueryFilter.SubFields = "FULLNAME"pQueryFilter.WhereClause = "OBJECTID &amp;gt; 10"
Dim pQueryFilterDefinition As IQueryFilterDefinitionSet pQueryFilterDefinition = pQueryFilterpQueryFilterDefinition.PostFixClause = "ORDER BY FULLNAME"
Dim pFeatureCursor As IFeatureCursorSet pFeatureCursor = pFeatureClass.Search(pQueryFilter, True)
Dim codeix As Longcodeix = pFeatureCursor.FindField("FULLNAME")
Dim pFeature As IFeatureSet pFeature = pFeatureCursor.NextFeature
While Not pFeature Is Nothing&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox pFeature.Value(codeix)&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFeature = pFeatureCursor.NextFeatureWend

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another forum example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim queryFilter As IQueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set queryFilter = new QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;queryFilter.WhereClause = "theField = 'abc'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim queryFilterDef As IQueryFilterDefinition&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set queryFilterDef = queryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;queryFilterDef.PostfixClause = "ORDER BY sortField"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:04:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449541#M12203</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-12-11T20:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449542#M12204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No luck. I tried that syntax and I'd already referenced that VB6 example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks you Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 14:19:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449542#M12204</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-11-16T14:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449543#M12205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do filegeodatabase support the ORDER BY function? They didn't used to in ArcGIS 9 - not sure whether they do or not in 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003n00000032000000:"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003n00000032000000:&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;File geodatabases do not support all the features and functions available for personal geodatabases. At ArcGIS 9.2, the most commonly used functions not supported by file geodatabases include DISTINCT, GROUP BY, and ORDER BY, and the set functions AVG, COUNT, MIN, MAX, and SUM are not supported outside subqueries. Support for some of these is likely to be added in future releases.&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 14:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449543#M12205</guid>
      <dc:creator>AndrewMay</dc:creator>
      <dc:date>2012-11-16T14:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449544#M12206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Do filegeodatabase support the ORDER BY function? They didn't used to in ArcGIS 9 - not sure whether they do or not in 10.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's a question I was hoping someone else could answer, haha. I see it's supported in subqueries. Can I somehow use subqueries as a workaround. I don't really understand the syntax for subqueries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for you reply Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 14:49:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449544#M12206</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-11-16T14:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449545#M12207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this link answers your question that this is not currently possible:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/TklNMDY0NDcy"&gt;http://support.esri.com/en/bugs/nimbus/TklNMDY0NDcy&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any chance you could call this layer from an SDE geodatabase where ORDER BY is supported?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might try a personal geodatabase as it might also be supported there, but you would need to test that out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:06:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449545#M12207</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-11-16T15:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449546#M12208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We will actually be moving to an SDE environment for our current project, so I'm glad to know that it works there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wanted to know if it worked in File geodatabases for other/future purposes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:24:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449546#M12208</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-11-16T15:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449547#M12209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ORDER BY is supported by File Geodatabase at ArcGIS 10.0. You must include the sort field(s) in the field list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;' Select the fields to be returned queryFilter.SubFields = inputFieldName &amp;amp; ", SortSequence"&amp;nbsp; ' Set the filter to return only searchable queryFilter.WhereClause = """IsSearchable"" = 'Y'"&amp;nbsp; ' Use the PostfixClause to sort ascending&amp;nbsp; Dim queryFilterDef As IQueryFilterDefinition2 = CType(queryFilter, IQueryFilterDefinition2)&amp;nbsp; queryFilterDef.PostfixClause = "ORDER BY SortSequence"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:25:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449547#M12209</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2012-11-16T15:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449548#M12210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ORDER BY is supported by File Geodatabase at ArcGIS 10.0. You must include the sort field(s) in the field list.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for responding Lance, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what you mean by field list. Perhaps you could take a quick look at my code up top and see where I went wrong? Or point me towards an example where this field list is used/documented/explained?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-cdebruin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:35:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449548#M12210</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-11-16T15:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449549#M12211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;See the code fragment that I posted. SubField is the field list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449549#M12211</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2012-11-16T15:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449550#M12212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Corbin:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you please post your code when you have it working with the file geodatabase?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lance:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How come the NIM I referenced says that this functionality is on-hold for file geodatabases, but you say it actually does work?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 15:49:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449550#M12212</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-11-16T15:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449551#M12213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It works!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Lance, you helped a lot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This Sub takes in 5 parameters, but it should work for anyone looking to populate a combobox from a table with SQL&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Public Sub LoadTblToCbx(inputTable As ITable, searchField As String, whereClause As String, sortField As String, cbxInput As System.Windows.Forms.ComboBox)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'CJD 11/15/2012 - uses SQL statements to query a geodatabase table and write selective values to a combobox

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cbxInput.Items.Clear() 'clear old comboboxitmes

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim queryFilter As IQueryFilter2 = New QueryFilter 'Create the query filter.

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Select the fields to be returned
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilter.SubFields = searchField &amp;amp; "," &amp;amp; sortField
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the field to query
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilter.WhereClause = whereClause

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Use the PostfixClause to sort ascending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim queryFilterDef As IQueryFilterDefinition2 = CType(queryFilter, IQueryFilterDefinition2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryFilterDef.PostfixClause = "ORDER BY " &amp;amp; sortField

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim fieldIndex As Integer = inputTable.FindField(searchField)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim cursor As ICursor = inputTable.Search(queryFilter, True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim row As IRow = cursor.NextRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not row Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim field As String = Convert.ToString(row.Value(fieldIndex))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cbxInput.Items.Add(field)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.NextRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End While

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marshal.FinalReleaseComObject(cursor)

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449551#M12213</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2021-12-11T20:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: SQL statements</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449552#M12214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Corbin:&lt;BR /&gt;&lt;BR /&gt;Can you please post your code when you have it working with the file geodatabase?&lt;BR /&gt;&lt;BR /&gt;Lance:&lt;BR /&gt;&lt;BR /&gt;How come the NIM I referenced says that this functionality is on-hold for file geodatabases, but you say it actually does work?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The NIMBUS bug is for the File Geodatabase API, where we don't support ORDER BY. We added significant SQL functionality to the File Geodatabase at 10.0 and 10.1. This includes ORDER BY and GROUP BY (10.1). None of this was ported to the File Geodatabase API.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 16:19:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/sql-statements/m-p/449552#M12214</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2012-11-16T16:19:45Z</dc:date>
    </item>
  </channel>
</rss>

