QUery Failed:

448
1
Jump to solution
08-29-2013 12:11 PM
JeffFrye
New Contributor
I am using a queryTask with ZoomTo off of an EXECUTE Button. When I first click the button, I receive the ERROR CODE 400: Unable to complete operation. If I click OK then click EXECUTE again, the query is fine and the point displays and zooms accordingly.

// Draw results when query is complete.
        private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
        {
            // Clear previous results.
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();

            // Check for new results.
            FeatureSet featureSet = args.FeatureSet;
            if (featureSet.Features.Count > 0)
            {
                // Add results to the map.
                foreach (Graphic resultFeature in featureSet.Features)
                {
                    resultFeature.Symbol = LayoutRoot.Resources["ResultsMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol;
                    graphicsLayer.Graphics.Add(resultFeature);

                    MapPoint communityPoint = graphicsLayer.Graphics[0].Geometry as MapPoint;

                    ESRI.ArcGIS.Client.Geometry.Envelope e = new ESRI.ArcGIS.Client.Geometry.Envelope(
                        communityPoint.X - 1000,
                        communityPoint.Y - 1000,
                        communityPoint.X + 1000,
                        communityPoint.Y + 1000);
                    MyMap.ZoomTo(e);

                }
            }
            else
            {
                MessageBox.Show("No features found");
            }
        }
0 Kudos
1 Solution

Accepted Solutions
LanceCrumbliss
Occasional Contributor II
I think this is actually a bug in the version of ArcGIS Server you are querying.

Add a string to the end of your query like "1=1", but make it dynamic so it isn't cached.:


Dim q As New Query() Dim dirty As String = Date.Now.Ticks.ToString q.Where = String.Format("{0}={1} AND {2}={2}", "FID", "10", dirty)

View solution in original post

0 Kudos
1 Reply
LanceCrumbliss
Occasional Contributor II
I think this is actually a bug in the version of ArcGIS Server you are querying.

Add a string to the end of your query like "1=1", but make it dynamic so it isn't cached.:


Dim q As New Query() Dim dirty As String = Date.Now.Ticks.ToString q.Where = String.Format("{0}={1} AND {2}={2}", "FID", "10", dirty)
0 Kudos