Query failed: Error code '400': 'Invalid or missing input parameters.'

8667
3
12-22-2012 10:19 PM
Labels (1)
ArielLomes
New Contributor III
Hello,

I'm trying to incorporate the code from the query example.

I created this private sub:
        Private Sub QueryButton_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles QueryButton.Click
            If QuerTextBox.Text.ToString().Contains("Enter Search") Then
                Return
            End If
            Dim queryTask2 As New QueryTask()
            queryTask2.Url = _mapService.UrlMapService & "/2"
            AddHandler queryTask2.ExecuteCompleted, AddressOf QueryTask_ExecuteCompleted
            AddHandler queryTask2.Failed, AddressOf QueryTask_Failed

            Dim query2 As Query = New ESRI.ArcGIS.Client.Tasks.Query()
            query2.Text = QuerTextBox.Text
            query2.OutFields.Add("*")

            query2.ReturnGeometry = True
            queryTask2.ExecuteAsync(query2)
        End Sub



And whenever I click QueryButton I get the following message box:
"Query failed: Error code '400': 'Invalid or missing input parameters.'"

I tried break point and pressed F10 throuout all the sub. It finishes the sub then immediately goes to QueryTask_Failed for some reason without even trying to go into QueryTask_ExecuteCompleted.

Can anyone please help me?

Thanks in advance.
0 Kudos
3 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Is there any information in the TaskFailedEventArgs.Error.Message ?

Does your local map service (started from an MPK) contain 3 layers? At the line queryTask2.Url = _mapService.UrlMapService & "/2" it's using a zero-based indexing to refer to a specific layer within the local map service. Therefore, if you don't have 3 layers the URL it's constructing won't be a valid which would trigger the failed event immediately.

Cheers

Mike
0 Kudos
LesliePurgason1
New Contributor
I had this same problem and I finally fixed the problem:

Make sure you have the same fields in the search results as you have in the table the search is linked to.

It was a simple fix that took me awhile to find (as these things usually go). I had included a field that was visible in other tables, but that I had had turned off in this table before publishing the map.

Hope this helps!
raffia
by
New Contributor II
I had this same problem and I finally fixed the problem:

Make sure you have the same fields in the search results as you have in the table the search is linked to.

It was a simple fix that took me awhile to find (as these things usually go). I had included a field that was visible in other tables, but that I had had turned off in this table before publishing the map.

Hope this helps!


Hi, I couldn't exactly understand this solution, I am having this same exact problem through our Map Service:
http://tela.roktech.net/arcgis/rest/services/DigitalEgypt/CFC_EN2/MapServer/5/query
I
f you put in the where box "1=1", still get this error

Unable to complete operation.

Thanks a lot.
0 Kudos