2 Replies - 339 Views - Last Post: 19 January 2012 - 10:51 AM Rate Topic: -----

Topic Sponsor:

#1 Ecstatic  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 39
  • Joined: 20-March 11

How to separate value from xml string?

Posted 17 January 2012 - 10:57 PM

I am creating a website with asp.net and sql server 2008. I used count() to count number of rows in a table and returned the result in a label. The label does show 43(counted rows) on the web page but I cannot use label.text anywhere in the code afterwards because it says its in invalid format. When I debug it i see this string stored in the label:

<NewDataSet>
<Table1>
<Column1>43</Column1> 
</Table1>
</NewDataSet>


The Code I have written is:
        mainprog y = new mainprog();  //mainprog is the main class I have (C#)
        DataSet d = null;
        d = y.stdcount();             //stdcount() is the function for counting number of rows in table
        stdno.Text = d.GetXml();      //stdno is the label I am using to output the value of count



After this I have to use that count as an argument in the next function. How can I separate count from the above string?
I will be thankful for any help...

Is This A Good Question/Topic? 0
  • +

Replies To: How to separate value from xml string?

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1757
  • View blog
  • Posts: 2,693
  • Joined: 08-June 10

Re: How to separate value from xml string?

Posted 18 January 2012 - 04:34 AM

** Moved to ASP.NET **
Was This Post Helpful? 0
  • +
  • -

#3 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 202
  • View blog
  • Posts: 775
  • Joined: 03-June 10

Re: How to separate value from xml string?

Posted 19 January 2012 - 10:51 AM

Use the XmlDocument class to help work with the XML.

You can retrieve the XmlNode that you are looking for and then retrieve it's value using the XmlNode.

Check out the documentation for more details :)

-Frinny
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1