wcf and returning a datatable

D

dave

i have a working wcf service and am having problems returning a datatable
from the wcf service.
I am able to return properties and collections of objects however when
returning a datatable i am getting a returned type of
'CheckListResponseCheckListResult' (where checklist is the name of the
function that returns the datatable)

testing code below
Dim stmp As WF374WCF.CheckListResponseCheckListResult =
svc.CheckList(97)
Console.WriteLine(stmp.Any)

stmp.any is an xmlelement (which appears to have the schema information but
i have yet to find the data (rows) within the return object.

How do i get the datatable rehydrated on the client site?

thank you
dave
 
T

Tiago Halm

A datatable is serialized via .NET Serialization, and you're building a
WebService where the standard serialization (optimized for SOAP
interoperability scenarios) is used. The standard serialization applies to
simple types or complex types decorated with DataContract attribute.
DataTable is not a simple type.

The datatable serialization is not universal, is only .NET specific. You
would be better off creating a DataContract with the expected struct the
DataTable contains and return a List<MyStruct>.

Tiago Halm
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top