E
Edward Mitchell
I have a string containing the XML text of my database. How can I create a
data set from this String?
The simple way would be to convert the String to a memory stream and then
read that memory stream using DataSet.ReadXml(...). However I can't find a
way to create a MemoryStream from a String. One of the constructors for
MemoryStream needs a byte[] array. I don't know how to get this out of the
string. I can get a char[] array but that's not compatible with a byte[]
array.
This is the sample code I was trying to use:
String sClassesXml = (String) Session["ClassesXml"];
// doesn't work!!!
byte[] baClassesXml = sClassesXml.ToCharArray();
MemoryStream ms = new MemoryStream(baClassesXml);
DataSet ds = new DataSet();
ds.ReadXml(ms);
It would be easy in C++!
Ed
--
Edward E.L. Mitchell
Web: www.racesail.org
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908
data set from this String?
The simple way would be to convert the String to a memory stream and then
read that memory stream using DataSet.ReadXml(...). However I can't find a
way to create a MemoryStream from a String. One of the constructors for
MemoryStream needs a byte[] array. I don't know how to get this out of the
string. I can get a char[] array but that's not compatible with a byte[]
array.
This is the sample code I was trying to use:
String sClassesXml = (String) Session["ClassesXml"];
// doesn't work!!!
byte[] baClassesXml = sClassesXml.ToCharArray();
MemoryStream ms = new MemoryStream(baClassesXml);
DataSet ds = new DataSet();
ds.ReadXml(ms);
It would be easy in C++!
Ed
--
Edward E.L. Mitchell
Web: www.racesail.org
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908