I thought I heard that v2 would allow a WebService to return a DataTable.

Discussion in 'ASP .Net Web Services' started by Tony, Feb 11, 2006.

  1. Tony

    Tony Guest

    I thought I heard that v2 would allow a WebService to return a DataTable.
    I've tried this but it doesn't seem to work, the WebService compiles but I
    can't hook a client up to the method, so I have resorted back to creating a
    DataSet just to transport a stupid DataTable which seems like such a waste
    of code, execution time, and network bandwidth.

    Am I missing something???

    Thanks,
    Tony
    Tony, Feb 11, 2006
    #1
    1. Advertising

  2. Tony

    Josh Twist Guest

    Josh Twist, Feb 11, 2006
    #2
    1. Advertising

  3. Tony

    Tony Guest

    Yes, but that is not of much help since it just states you shouldn't but
    doesn't provide a better alternative.
    I'm open to suggestions of a better workable solution.

    Tony

    "Josh Twist" <> wrote in message
    news:...
    > Hi Tony,
    >
    > Sorry I'm not answering your question here but you may be interested in
    > this. I tend to point most people at thsi who ask about returning
    > DataSets and DataTables - it maybe worth a rethink :)
    >
    > http://www.hanselman.com/blog/Retur...ndRepresentsAllThatIsTrulyEvilInTheWorld.aspx
    >
    > Josh
    > http://www.thejoyofcode.com/
    >
    Tony, Feb 11, 2006
    #3
  4. Tony

    Josh Twist Guest

    The better alternative is to return 'real' objects. For example, if
    your WebMethod is called GetApple, then your web service should return
    'Apples'. That is a class Apple with the appropriate properties rather
    than returning a DataSet/Table that contains columns with properties of
    Apples. It's what web services are all about.

    public class Apples
    {
    public string Type;
    public int Weight;
    public string Color;
    }

    Anyway, good luck however you decide to proceed!

    Josh
    http://www.thejoyofcode.com/
    Josh Twist, Feb 12, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Milstead

    CSS Not What I Thought It Would Be

    Tim Milstead, Mar 3, 2006, in forum: HTML
    Replies:
    21
    Views:
    799
    dorayme
    Mar 8, 2006
  2. Replies:
    0
    Views:
    518
  3. Frank Millman
    Replies:
    0
    Views:
    86
    Frank Millman
    Mar 18, 2013
  4. Chris Angelico
    Replies:
    1
    Views:
    105
    Steven D'Aprano
    Mar 18, 2013
  5. Frank Millman
    Replies:
    0
    Views:
    85
    Frank Millman
    Mar 18, 2013
Loading...

Share This Page