I am using a web service to query data from a table. Then I have to send it to a user who wants it as a DataTable. Can I serialize the data? Or should I send it as A DataSet. I am new to Web Services, so I am not sure the best way to do it.
You can send the data as a xml string from a dataset by DataSet.GetXml()
And than the user can deserialize it with DataSet.ReadXml()
And get the datatable from the dataset by DataSet.Tables
Good luck
If you expose it as a DataSet/DataTable, it will do its own serialization anyway (via IXmlSerializable, IIRC). Note that DataSet/DataTable don't make for good data-types on web services if you want the service to be portable to other patforms (i.e. a java client, etc). But you can simply expose it as such if you want...; .NET will deal with the translation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With