Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML To Dataset
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01303148
Message ID:
01303164
Views:
20
Hi,
Sure it works. But why bother to convert to XML and back again.
Why not let .NET take care of the plumbing.

>Ok, this works.
>
>
>public void UpdateUser(string sUserXML)
>{
>
>    StringReader oReader = new System.IO.StringReader(sUserXML);
>    DataSet oDataSet = new DataSet();
>    oDataSet.ReadXml(oReader);
>
>}
>
>
>
>The ReadXml method has an overload which accepts an XmlReadMode value. I tried several and it results in
>an empty dataset. If I leave if off, the DS is populated.
>
>
>
>
>
>>>>>I am passing a dataset as XML to a web service, which then passes it to a data class where it will be 'onverted'
>>>>>back into a data set.
>>>>>
>>>>>1) How to I get the XML back into a data set?
>>>>>
>>>>>2) How do I update the DB from the dataset?
>>>>
>>>>1) Look at the DataSet.ReadXML method.
>>>
>>>Actualy I found that, but it throws an exception "Illegal characters in path" error.
>>>
>>>[UPDATE] Looks like ReadXml is for reading from a file. I'm passing an XML string to
>>>this method and want to put it back into a dataset.
>>>
>>>See this http://www.java2s.com/Tutorial/CSharp/0540__XML/LoadXMLtoDataSet.htm
>>
>>There are several overloads. Maybe the one reading in a stream is what you are looking for?
>>
>>>>
>>>>2) I usually loop through the rows in the DataSet and save them one-by-one using normal ADO.NET methods. I know there are other fancier ways to do it with DataSets, but I am mostly a business objects guy so I don't know those offhand.
>>>
>>>Ok
>>>
>>>>
>>>>3) You almost had me look up "onverted" in a dictionary before I realized the typo...
>>>
>>>Doesn't everyone 'onvert' their data?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform