Passing dataset to web service

  • Thread starter Thread starter Bob
  • Start date Start date
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
 
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)?
 
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
 
Back
Top