Serialize a Dataset

T

Tom_B

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
 
D

Dino Chiesa [Microsoft]

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 said:
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.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top