Linq error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Supremelink

    Linq error

    Hi all,

    I have a problem with linq in a webservice.

    While executing a simple query like:

    var result = from customer in dbConn.Customer s
    select customer;

    I get this error message: "Cannot use wildcards at the top level of a
    schema".

    I have no idea why. This is the only thing my web method contains for
    the moment.

    Does anyone knows about this?

    Thanks in advance
    Marre
  • Michael Nemtsev [MVP]

    #2
    Re: Linq error

    Hello Supremelink,

    You need to trace SQL query of your provider to understand what's goin' on,
    because the results may be different for each type of providers

    see there sample how to install and use LINQ to SQL debug visualizer http://www.talentgrouplabs.com/blog/...rated-sql.aspx

    ---
    WBR,
    Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

    "The greatest danger for most of us is not that our aim is too high and we
    miss it, but that it is too low and we reach it" (c) Michelangelo


    SHi all,
    S>
    SI have a problem with linq in a webservice.
    S>
    SWhile executing a simple query like:
    S>
    Svar result = from customer in dbConn.Customer s
    Sselect customer;
    SI get this error message: "Cannot use wildcards at the top level of a
    Sschema".
    S>
    SI have no idea why. This is the only thing my web method contains for
    Sthe moment.
    S>
    SDoes anyone knows about this?
    S>
    SThanks in advance
    SMarre


    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: Linq error

      On Feb 5, 1:10 pm, Supremelink <martin.anders. ..@supremelink. se>
      wrote:
      Does anyone knows about this?
      >
      What LINQ provider are you using?
      >
      I´m using LINQ to XML.
      I don't think you are for "var result = from customer in
      dbConn.Customer s select customer; "

      The first step I'd suggest is trying to reproduce the error in a
      console application - work out whether the problem is with SOAP, or
      creating the XElement, or executing the query to start with. You've
      got a whole bunch of things going on in a short space - you need to
      separate them out.

      Jon

      Comment

      • Marc Gravell

        #4
        Re: Linq error

        oh, btw, to get the outer "Customers" (rather than ArrayOfCustomer ),
        you can use:

        [WebMethod]
        [return: XmlRoot("Custom ers")]
        public Customer[] Foo() {
        // ...
        }

        Marc


        Comment

        • Supremelink

          #5
          Re: Linq error

          On 5 Feb, 15:25, "Marc Gravell" <marc.grav...@g mail.comwrote:
          oh, btw, to get the outer "Customers" (rather than ArrayOfCustomer ),
          you can use:
          >
          [WebMethod]
          [return: XmlRoot("Custom ers")]
          public Customer[] Foo() {
          // ...
          >
          }
          >
          Marc
          Marc,

          Many thanks

          You will get a star next to you're name in "my book" ;)

          Best regards
          Marre

          Comment

          Working...