order by is not working

2321
2
Jump to solution
07-05-2012 11:06 AM
ForamParikh
Occasional Contributor
Hello everyone,

I am using 3.0 version API and i want to bind my combobox.

I am using query and i use orderbyfields but in combobox items are not arranged in alphabetically.

below is my code

query.OrderByFields = new List<OrderByField>() { new OrderByField("PO_NAME", SortOrder.Ascending) };
                query.OutFields.Add("*");
                query.ReturnGeometry = false;
                query.Where = "1=1";
                queryTask.ExecuteAsync(query);

in execute completed


                foreach (Graphic graphic in args.FeatureSet.Features)
                {
                    if (searchspacial.SelectedValue.ToString() == "Watershed")                   
                        watershedcitybind.Items.Add(graphic.Attributes["name"].ToString());                   
                    else if (searchspacial.SelectedValue.ToString() == "City")
                        watershedcitybind.Items.Add(graphic.Attributes["PO_NAME"].ToString());
                  }

where watershedcitybind is combobox which is not showing items in order.

Please help,

Thanks
Foram
0 Kudos
1 Solution

Accepted Solutions
JoeHershman
MVP Regular Contributor
Are your FeatureClasses stored in an enterprise GDB (e.g., Oracle, SQL Server)?  I believe OrderBy functionality is only supported in an enterprise GDB and will not work with a file GDB.
Thanks,
-Joe

View solution in original post

0 Kudos
2 Replies
JoeHershman
MVP Regular Contributor
Are your FeatureClasses stored in an enterprise GDB (e.g., Oracle, SQL Server)?  I believe OrderBy functionality is only supported in an enterprise GDB and will not work with a file GDB.
Thanks,
-Joe
0 Kudos
shanliu
New Contributor
Because OrderByFields and GroupByFields are both  the new capabilities in  10.1 for server.
0 Kudos