[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

DataTable as parm to a WebMethod function?

Aleksey Nudelman

8/29/2003 4:35:00 PM

According to MS, DataTable cannot be passed or returned by
a Web Service.
Try using DataSet instead.
Aleksey
>-----Original Message-----
>
>I've stumbled across a problem while developing an
>ASP.NET Web Service that I hope someone can shed some
>light on. The problem occurs any time I include a
>System.Data.DataTable object in the parameter list of a
>WebMethod call. The Web Service project builds fine, but
>when you navigate in your browser to the .asmx file then
>you get an error message that basically says: "Cannot
>serialize member
>System.ComponentModel.MarshalByValueComponent.Site of
>type System.ComponentModel.ISite because it is an
>interface."
>
>The docs state that the only 2 data objects that are
>serializable are the DataSet and the DataTable, so I
>would assume that this means I can pass either object
>into and out of a web service. Furthermore, a DataSet can
>be serialized without a problem....even though a DataSet
>contains a collection of DataTables.
>
>It's very easy to duplicate this problem. Just include
>the following WebMethod call in an ASP.NET Web Service
>project and then pull up the associated .asmx file. IE
>will display a page long error description that basically
>shows that a DataTable cannot be serialized (reflected)
>to XML. Here's a sample WebMethod call in VB.NET:
>
><WebMethod()> Public Sub TestTable(ByVal dataTbl As
>System.Data.DataTable)
> ' Do Nothing
>End Sub
>
>
>I've tried this example running versions 1.0.3705 and
>1.1.4322 of the frameworks, if that helps any. I've
>searched the KB and google's archived newsgroups but I
>can't seem to find any info relating to this issue. I've
>also tried running this sample on 2 separate boxes and I
>always end up with the same results.
>
>Any clues?
>
>Thanks much.
>Keith Primeaux, MCSD
>Automated Filing Systems, Inc.
>.
>