Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 11 Feb 2006 07:41 GMT
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
Josh Twist - 11 Feb 2006 16:22 GMT
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/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanA
ndRepresentsAllThatIsTrulyEvilInTheWorld.aspx


Josh
http://www.thejoyofcode.com/
Tony - 11 Feb 2006 21:18 GMT
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

> Hi Tony,
>
[quoted text clipped - 6 lines]
> Josh
> http://www.thejoyofcode.com/
Josh Twist - 12 Feb 2006 10:02 GMT
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/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.