I have a feature class (MyStreamsFeatureClass below) that I am trying to query features specifying an IQueryFilterDefinition.PostfixClause that specifies to order by a particular field. When I loop through these features after applying the search, the results are in the same order that they are in the shape file, as if the filter is not ordering them. What am I missing?
'perform a query
Dim MyQueryFilter As ESRI.ArcGIS.Geodatabase.IQueryFilter = New ESRI.ArcGIS.Geodatabase.QueryFilter
MyQueryFilter.SubFields = "SEG_NAME, SEG_TYPE"
'order clause, by name
Dim MyQueryFilterDef As ESRI.ArcGIS.Geodatabase.IQueryFilterDefinition = CType(MyQueryFilter, ESRI.ArcGIS.Geodatabase.IQueryFilterDefinition)
MyQueryFilterDef.PostfixClause = "ORDER BY SEG_NAME"
'get table from feature class
Dim MyTable As ESRI.ArcGIS.Geodatabase.ITable = CType(MyStreamsFeatureClass, ESRI.ArcGIS.Geodatabase.ITable)
'output the returned results of the query
Dim MyCursor As ESRI.ArcGIS.Geodatabase.ICursor = MyTable.Search(MyQueryFilter, False)
Dim MyRow As ESRI.ArcGIS.Geodatabase.IRow = MyCursor.NextRow
Dim StreamsList As String = "Alphabetical Listing of Streams" & Environment.NewLine
While MyRow IsNot Nothing
StreamsList &= Convert.ToString(MyRow.Value(MyTable.FindField("SEG_NAME"))) & ", " & _
Convert.ToString(MyRow.Value(MyTable.FindField("SEG_TYPE"))) & Environment.NewLine
MyRow = MyCursor.NextRow
End While
System.Windows.Forms.MessageBox.Show(StreamsList)