Serialize a Dataset

Discussion in 'ASP .Net Web Services' started by Tom_B, May 18, 2004.

  1. Tom_B

    Tom_B Guest

    Trying to send a dataset as the return information in a Web Service. For example: client contacts web service with an ID and then WS returns dataset for that ID. Was trying to return as the string of a function call. Understand how to serialize the dataset into XML. Cannot figure out how to put into a streamwriter, textwriter, etc. and return with the function. Thanks

    <WebMethod()>
    Public Function VenueData(ByVal VenueID As Integer) As Strin
    SqlConnection1.Open(
    SqlDataAdapterVenue.Fill(DataSetVenues
    SqlDataAdapterEvents.Fill(DataSetVenues
    SqlDataAdapterPerformances.Fill(DataSetVenues
    SqlConnection1.Close(

    Dim XmlDataSerializer As New XmlSerializer(GetType(DataSetVenues)
    Dim StreamWriter As ?????
    XmlDataSerializer.Serialize(StreamWriter, XmlDataSerializer
    Return ?????
    StreamWriter.Close(
    End Function
    Tom_B, May 18, 2004
    #1
    1. Advertising

  2. if you are trying to return a dataset, why not just....um...... do it?

    <WebMethod()> _
    Public Function VenueData(ByVal VenueID As Integer) As DataSet
    SqlConnection1.Open()
    SqlDataAdapterVenue.Fill(DataSetVenues)
    SqlDataAdapterEvents.Fill(DataSetVenues)
    SqlDataAdapterPerformances.Fill(DataSetVenues)
    SqlConnection1.Close()
    return DataSetVenues
    End Function

    or if you want a string, do this:

    return DataSetVenues.GetXml ()


    ? does that work ?

    ps: Dataset is not good for interop with non-.NET clients. But it will work
    with a .NET client.

    -Dino


    "Tom_B" <> wrote in message
    news:...
    > Trying to send a dataset as the return information in a Web Service. For

    example: client contacts web service with an ID and then WS returns dataset
    for that ID. Was trying to return as the string of a function call.
    Understand how to serialize the dataset into XML. Cannot figure out how to
    put into a streamwriter, textwriter, etc. and return with the function.
    Thanks.
    >
    > <WebMethod()> _
    > Public Function VenueData(ByVal VenueID As Integer) As String
    > SqlConnection1.Open()
    > SqlDataAdapterVenue.Fill(DataSetVenues)
    > SqlDataAdapterEvents.Fill(DataSetVenues)
    > SqlDataAdapterPerformances.Fill(DataSetVenues)
    > SqlConnection1.Close()
    >
    > Dim XmlDataSerializer As New XmlSerializer(GetType(DataSetVenues))
    > Dim StreamWriter As ??????
    > XmlDataSerializer.Serialize(StreamWriter, XmlDataSerializer)
    > Return ??????
    > StreamWriter.Close()
    > End Function
    Dino Chiesa [Microsoft], May 21, 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,778
    Chris Taylor
    Oct 31, 2003
  2. JimO

    DataSet and dataSet

    JimO, Mar 1, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    510
    Mary Chipman [MSFT]
    Mar 8, 2006
  3. Joseph D. DeJohn

    DataSet to DataSet

    Joseph D. DeJohn, Aug 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    387
  4. Gordz
    Replies:
    3
    Views:
    3,926
    John Oakes
    Jun 7, 2004
  5. Replies:
    1
    Views:
    154
    Vedran SubotiƦ
    Sep 7, 2005
Loading...

Share This Page