Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Serialize a Dataset

Reply
Thread Tools

Serialize a Dataset

 
 
Tom_B
Guest
Posts: n/a
 
      05-18-2004
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
 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      05-21-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet and dataSet JimO ASP .Net 2 03-08-2006 02:39 PM
how do I remove extra data from serialize XML string of a DataSet IMS.Rushikesh@gmail.com ASP .Net Web Services 1 09-07-2005 04:20 PM
serialize to SQL Server Blob instead of XML serialize Gordz ASP .Net 3 06-07-2004 07:46 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM
DataSet to DataSet Joseph D. DeJohn ASP .Net 1 08-04-2003 03:25 AM



Advertisments