Passing dataset to web service

B

Bob

Hi,

Can anyone tell me how to resolve this:

I am calling a web service from a WinForm app and passing a typed dataset as
a parameter. I have added the dataset to the web service project but I get
an error telling me that the WinForm dataset can't be converted to the web
service dataset - even though they are exactly the same.

How do I get around this? I have tried using CType and DirectCast but always
get a "specified cast is invalid" error.

I am sure there is a simple solution to this but I can't find it.... and I
don't want to resort to using an untyped dataset on the web service side of
things (which I know I can get to work).


Cheers
 
S

Scott M.

Have you tried writing the dataset data and the dataset schema out and
passing that to you other dataset (and then read that schema and data xml
into it)?
 
D

David Browne

Bob said:
Hi,

Can anyone tell me how to resolve this:

I am calling a web service from a WinForm app and passing a typed dataset
as
a parameter. I have added the dataset to the web service project but I get
an error telling me that the WinForm dataset can't be converted to the web
service dataset - even though they are exactly the same.

How do I get around this? I have tried using CType and DirectCast but
always
get a "specified cast is invalid" error.

I am sure there is a simple solution to this but I can't find it.... and I
don't want to resort to using an untyped dataset on the web service side
of
things (which I know I can get to work).

The immediate cause of your problem is that you have created two different
types.

MyWinform.DataSet1
and
MyWebService.DataSet1

Since they are not the same type, you can't do CType or DirectCast. Try
using the same type (not just the same schema) for both projects.

David
 

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