How do I populate a DataSet from a XML string?
-
HI, I am having a string which is in xml format. i want to populate a dataset using the string. I used the following code . But it doesnt convert.Please help me.
stream = new StringReader(XMLdoc.ToString());
Text = new XmlTextReader(stream);
dsXml.ReadXml(Text); -
HI, I am having a string which is in xml format. i want to populate a dataset using the string. I used the following code . But it doesnt convert.Please help me.
stream = new StringReader(XMLdoc.ToString());
Text = new XmlTextReader(stream);
dsXml.ReadXml(Text);You might want to have a look at the
dataSet.ReadXml()
method. http://msdn.microsoft.com/en-us/library/system.data.dataset.readxml(VS.71).aspx[^] Hope that helps. -
HI, I am having a string which is in xml format. i want to populate a dataset using the string. I used the following code . But it doesnt convert.Please help me.
stream = new StringReader(XMLdoc.ToString());
Text = new XmlTextReader(stream);
dsXml.ReadXml(Text);anu_anu wrote:
stream = new StringReader(XMLdoc.ToString());
where is the xml doc present..! try this..!:cool:
ds.ReadXml ("YourFilePath in Server.mapath.xml);
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
-
anu_anu wrote:
stream = new StringReader(XMLdoc.ToString());
where is the xml doc present..! try this..!:cool:
ds.ReadXml ("YourFilePath in Server.mapath.xml);
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
Hi, I just have the XML code in XMLdoc as string format.I dont have any xml file.
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadLine(); while (str != null) { XMLdoc = XMLdoc + str; Console.WriteLine(str); str = reader.ReadLine(); }
-
Hi, I just have the XML code in XMLdoc as string format.I dont have any xml file.
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadLine(); while (str != null) { XMLdoc = XMLdoc + str; Console.WriteLine(str); str = reader.ReadLine(); }
anu_anu wrote:
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadLine(); Check The above str reading any document in the form of xml by keeping a break point may tht the reason..!
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
-
anu_anu wrote:
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadLine(); Check The above str reading any document in the form of xml by keeping a break point may tht the reason..!
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
-
Check the response stream, and keep a break point on the bolded text ,extract the string str, .and check the string format.Is it coming in the form of XML. if it is comming..! use ReadtoEnd metod
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();// Close and clean up the StreamReader sr.Close(); }
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
-
Check the response stream, and keep a break point on the bolded text ,extract the string str, .and check the string format.Is it coming in the form of XML. if it is comming..! use ReadtoEnd metod
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();// Close and clean up the StreamReader sr.Close(); }
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.
-
Ya.. It is in the xml format.Is it possible to assign the xml string into a new xml file.
Then Try this below link It May Help Post XML Data to an ASP.NET Page using C#[^]
MyFirstArticlePublished: MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.