Hi don't repost your question again and again.
Your code has many errors basically.
ds.WriteXml(sStream)
won't work.
WriteXml
method only works with FileStreams.
byReturn = sStream.ToString()
what you want to do here?
Your method says convert to byte but it returns a string. Do you understand you are confusing people here?
However if your aim is to get the xml string from data set then use the dataset's
getXml()
function (
string resultString=ds.GetXml();
). If you want to convert that string to bytes then use
byte[] bytes=Encoding.Unicode.GetBytes(resultString);
. If bytes back to string then
string resultString1 = Encoding.Unicode.GetString(bytes);
.
XML string back to Dataset
TextReader reader = new StringReader(resultString1);
DataSet ds1 = new DataSet();
ds1.ReadXml(reader);
It is unclear how you transfer your byte or string to another client. So that is your headache. if you transfer the right data and get right data it will work fine.
Good luck.