470,848 Members | 1,723 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

Web Service Returns DataTable or DataReader

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
Mar 2 '06 #1
4 2429
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
"Tedmond" <Te*****@discussions.microsoft.com> schreef in bericht
news:39**********************************@microsof t.com...
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

Mar 2 '06 #2

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

Tedmond wrote:
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


--
Mar 2 '06 #3
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
"John Bailo" wrote:

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

Tedmond wrote:
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


--

Mar 3 '06 #4
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
Mar 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Stephen | last post: by
6 posts views Thread by Mountain Bikn' Guy | last post: by
1 post views Thread by Janaka | last post: by
3 posts views Thread by Tim::.. | last post: by
9 posts views Thread by jsoques | last post: by
15 posts views Thread by Joseph Geretz | last post: by
5 posts views Thread by jehugaleahsa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.