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

T

Tony

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
 
T

Tony

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
 
J

Josh Twist

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/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top