Web Service Returns DataTable or DataReader

G

Guest

Dear all,

How to code a Web Service function that returns either a DataTable or
DataReader to the clients? Or I should use other alternative?

Thanks for any help!

Tedmond
 
C

Cor Ligthert [MVP]

Tedmond,

A pity is that the 2.0 sample seems never to be completed, it has some
problem especially about the Datatable.haschanges in it, a method that seems
for me to be forgotten to make in Net 2.0.

http://msdn2.microsoft.com/en-us/library/1as0t7ff.aspx

You can instead of that haschanges use
If datatable.Getchanges NotIs Nothing then (or the equivalent for C#)

I hope this helps,

Cor
 
J

John Bailo

A web method can return any datatype which is serializable in the SOAP XML
format.
Dear all,

How to code a Web Service function that returns either a DataTable or
DataReader to the clients? Or I should use other alternative?

Thanks for any help!

Tedmond

--
 
G

Guest

Hi John,

I have a testing web method that returns a DataView. It compiled ok but
when I update the web reference from client application project, I got the
following error,

<html>
.......
<title>You must implement the Add(System.Data.DataRowView) method on
System.Data.Datavidw because it inherits from ICollection.</title>
.....

Why? How can I solve it?

My web method is something like

[WebMethod(Description="Method returns DataView")]
[SoapInclude(typeof(DataView))]
public DataView getConfirmListDV(string returnNo)
{
DataView dv = new DataView();
...

return dv;
}

Thanks for your help!

Tedmond
 
C

Cor Ligthert [MVP]

Tedmond,

You never can pass a dataview outside your current application. The dataview
is an object that only holds references to other objects (DataTables) inside
your application. Those tables (only one at a time) are referenced by the
property. DataView.Table.

I hope this helps,

Cor
 

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

Top