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

Discussion created by ArielLo on Dec 22, 2012
Latest reply on Nov 30, 2013 by raffialexanian

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
            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.ReturnGeometry = True
        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.