locked
Bad Request - Error in query syntax while calling boolen retun type store procedure? RRS feed

  • Question

  • hi,

    i write following stored procedure which in copy data from one table to another table

                 

     [WebGet]
            public Boolean CopyMovableDatatoTempTable(int AdmissionNo)
            {
                try
                {
                    Entities.CopyMovabledataFormTempTable(AdmissionNo);
                    return true;
                }
                catch
                {
                    return false;
                }

            }

    while calling stored procedure it executing successfully  but it showing error meassage Bad Request - Error in query syntax

                        

    public void CopyDataFormMovableToTempTable()
            {

                 var CopyData = ObjPacsProductEntities.CreateQuery<Boolean>("CopyMovableDatatoTempTable").AddQueryOption("AdmissionNo", Admissionnumber);
               CopyData.BeginExecute(OnAsyncQueryExecutionComplete, CopyData);

            }

                               

     private void OnAsyncQueryExecutionComplete(IAsyncResult result)
            {
                try
                {


                    var query = result.AsyncState as DataServiceQuery<Boolean>;
                    query.EndExecute(result);//Here I am Getting Error


                }
                catch (DataServiceQueryException ex)
                {
                    QueryOperationResponse Reponce= ex.Response;
                    string Error = ee.Error.Message;
                }
            }

    How can Slove this .Thanks in Advance


    srikanth

    Thursday, June 28, 2012 10:34 AM

All replies

  • Hi,

    You could try to use Fiddler to see the actual query which is generated by the client and the response from the server. Also see this for more detailed error messages from the server: http://blogs.msdn.com/b/phaniraj/archive/2008/06/18/debugging-ado-net-data-services.aspx.

    As a design note: It's a bad practice to have service operations which modify some state using GET verb. The HTTP assumes that GET has no side effects (and thus you can cache its results and so on). For this kind of operation I would suggest using WebInvoke and thus POST verb. Then from the client call it using the DataServiceContext.Execute method. In the WCF DS 5.0 there are Execute overloads which let you specify the parameters for the service operation.

    Thanks,


    Vitek Karas [MSFT]

    Thursday, June 28, 2012 11:33 AM
    Moderator