Bad Request - Error in query syntax RRS feed

  • Question

  • Hi,

    When I use the CreateQuery to call a webget function on the server, I get "Error in query syntax". However the call is being made and processed on the server without problems. Only on the client that result can somehow not be processed.
    When I use context.Execute(url) then it all works. I need to use the CreateQuery.
    Any ideas?

    (VS2010 Beta2)

    Client Code that does not work:

    DataServiceQuery dsquery = searchEntitiesContext.CreateQuery<BusinessEntitySearchResult>("BusinessEntitySearch")
        .AddQueryOption("searchText", "'a*'").AddQueryOption("maxCount", "10");
    var list = dsquery.Execute();

    Client code that works:

    IEnumerable<BusinessEntitySearchResult> list = searchEntitiesContext.Execute<BusinessEntitySearchResult>(new Uri(query, UriKind.Relative));

    Server code:

    public ObjectResult<BusinessEntitySearchResult> BusinessEntitySearch(string searchText, int maxCount){
     String userName = string.Empty;
         if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.User != null && !string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name)) {
          userName = System.Web.HttpContext.Current.User.Identity.Name;
         ObjectResult<BusinessEntitySearchResult> searchResult = (new FullTextSearches()).BusinessEntitySearchInternal(searchText, maxCount, string.Empty, CurrentDataSource, userName);
         return searchResult;

    • Moved by Noam Ben-Ami - MSFT1 Monday, November 9, 2009 4:57 PM (From:ADO.NET Entity Framework and LINQ to Entities)
    Monday, November 9, 2009 4:09 PM


  • Hi,

    Both URI should work. there was a known issue in V1 where the () after entity set does make a difference, but that issue should have been fixed in .net 4.0 Beta 2.

    How is BusinessSearchResult defined on the server/client? If it's OK, can you create a small repro project and send it to me (pqian at microsoft dot com)?


    Peter Q. http://blogs.msdn.com/peter_qian
    Wednesday, November 11, 2009 11:57 PM

All replies