Problem passing a typed dataset to a web service

Discussion in 'ASP .Net Web Services' started by Justin Crossley, Nov 17, 2004.

  1. I'm having a type mismatch problem when trying to pass a typed dataset to a
    web service.

    My code is:

    CLIENT CODE

    I have a dataset schema file called MainData.xsd containing a table called
    mytable

    'create and fill typed dataset
    Dim dsMain As New MainData
    Dim con As New SqlConnection("myconnectionstring")
    Dim da As New SqlDataAdapter("select * .....", con)
    da.Fill(dsMain.mytable)

    'pass typed dataset to web service
    Dim ws As New localhost.DataTransfer
    ws.PassData(dsMain)

    WEB SERVICE CODE

    The web service also has an identical local file containing the data schema
    called MainData.xsd

    <WebMethod()> Public function PassData(Value as MainData)
    ....
    End Function


    Unfortunately I get an error when I hover over the PassData method that says
    'Value of Type MainData cannot be converted to localhost.MainData'.

    It is obviously treating the two data types as being different.

    If I change the parameter type of the PassData function to type DataSet then
    the function can be called OK, but then I lose the type information.

    Any ideas anybody?

    Thanks

    Justin Crossley
    Justin Crossley, Nov 17, 2004
    #1
    1. Advertising

  2. I think I saw that you asked this somewhere else.

    try this.
    http://msdn.microsoft.com/library/en-us/dnservice/html/service07162002.asp

    -D

    "Justin Crossley" <> wrote in message
    news:...
    > I'm having a type mismatch problem when trying to pass a typed dataset to
    > a web service.
    >
    > My code is:
    >
    > CLIENT CODE
    >
    > I have a dataset schema file called MainData.xsd containing a table called
    > mytable
    >
    > 'create and fill typed dataset
    > Dim dsMain As New MainData
    > Dim con As New SqlConnection("myconnectionstring")
    > Dim da As New SqlDataAdapter("select * .....", con)
    > da.Fill(dsMain.mytable)
    >
    > 'pass typed dataset to web service
    > Dim ws As New localhost.DataTransfer
    > ws.PassData(dsMain)
    >
    > WEB SERVICE CODE
    >
    > The web service also has an identical local file containing the data
    > schema called MainData.xsd
    >
    > <WebMethod()> Public function PassData(Value as MainData)
    > ...
    > End Function
    >
    >
    > Unfortunately I get an error when I hover over the PassData method that
    > says 'Value of Type MainData cannot be converted to localhost.MainData'.
    >
    > It is obviously treating the two data types as being different.
    >
    > If I change the parameter type of the PassData function to type DataSet
    > then the function can be called OK, but then I lose the type information.
    >
    > Any ideas anybody?
    >
    > Thanks
    >
    > Justin Crossley
    >
    Dino Chiesa [Microsoft], Nov 18, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nedu N
    Replies:
    1
    Views:
    1,772
    Chris Taylor
    Oct 31, 2003
  2. Adrian

    Typed DataSet serialization over Web Service

    Adrian, Oct 27, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    139
    Adrian
    Oct 27, 2003
  3. Peter R Lynch

    Typed Dataset Parameter In A Web Service Method

    Peter R Lynch, Jan 18, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    145
    Peter R Lynch
    Jan 18, 2004
  4. Ketchup
    Replies:
    1
    Views:
    229
    Jan Tielens
    May 25, 2004
  5. N. Shehzad

    returning strongly typed dataset from web service

    N. Shehzad, Mar 2, 2007, in forum: ASP .Net Web Services
    Replies:
    24
    Views:
    688
    John Saunders
    Mar 6, 2007
Loading...

Share This Page