locked
passing dataset from webserver RRS feed

  • Question

  • Hi
    I  have very interesting problem.

    I want to pass a typed dataset from my client app to the webserver application
    I created a webmethod and passed a dataset parameter to it
    when client app call my webmethod  client dataset is full -I show it.
    but this dataset arrived my web method dataset is nothing.

    Client metod

    DataSet ds = new DataSet();
    dataUpdateSysydate.DataLayer.Operation.Fill("SELECT * FROM CR1CAR , ds, "CR1CAR",CommandType.Text);

    ds = myWs.getCustNoasID(objDealerCode.ToString(), ds);

    My web Method

    <WebMethod()> _
          Public Function getCustNoasID(ByVal strDealer As String, ByVal ds As DataSet) As DataSet
            Dim dt As DataTable
          
            Try
                ' Araç Mğüşteri İlişkisini Düzenle
                If ds.Tables.Count > 0 Then
    ..........................................................

    I don't have any idea about how to perform that

    I create global.asax
    I changed some information on webconfig but I didn't sove this problem

    Thanks
    Tuesday, July 29, 2008 1:22 PM

Answers

  • The best practice is to not pass datasets between web services and clients. Use an equivalent POCO class instead. This is called the Data Transfer Object pattern (DTO).

    Consider that, unless the client and server are both running .NET, they will not both understand that what's being sent is a DataSet.

    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 1:48 AM
    Moderator

All replies

  •  Use the DataSet.GetXML method (which returns an XML string representing

    the DataSet) and pass that string to a web service web method.  Then that

    web method would declare a new DataSet and using the ReadXML method, it

    could read the XML string into itself.  You will need to load the XML string

    into an XMLDocument and then pass it to an XMLNodeReader so that it can be

    read into the DataSet using ReadXML.
    Thursday, July 31, 2008 5:53 AM
  • The best practice is to not pass datasets between web services and clients. Use an equivalent POCO class instead. This is called the Data Transfer Object pattern (DTO).

    Consider that, unless the client and server are both running .NET, they will not both understand that what's being sent is a DataSet.

    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 1:48 AM
    Moderator