Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:34:05+00:00 2026-06-03T22:34:05+00:00

We want to retrive penality from Xml tables on WebService. Our code reads the

  • 0

We want to retrive penality from Xml tables on WebService.
Our code reads the penalty value from first table and penalty value of the second table,
but at the run time it gives us the first value 2 times instead of resulting 2 different values of two tables.
Does anybody have an idea how should I edit my code to give the result specified higher? This is my code:

void pp_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    XElement resultElements = XElement.Parse(e.Result);

    List<StudentPunishment> sp = new List<StudentPunishment>();
    studentPunishmentsTables = resultElements.Element("studentPunishmentsTables").Value;

    string p = s.penalty;

    foreach (XElement nod in resultElements.Elements(@"studentPunishmentsTable"))
    {
        p = resultElements.Element("studentPunishmentsTable").Element("penalty").Value;
        MessageBox.Show(p);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:34:07+00:00Added an answer on June 3, 2026 at 10:34 pm

    This code works for me fine.

    foreach (XElement nod in resultElements.Elements(@"studentPunishmentsTable"))
    {
            s.penalty = nod.Element("penalty").Value;
            Console.WriteLine(s.penalty);     //MessageBox.Show(s.penalty);
    }
    

    But remeber to define ‘s’ object instance.

    http://prntscr.com/96nbh

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to retrive the table information from other server database. Query like 'Server2
I want to retrive a value from a NSDictionary. Here is a snippet of
I want to retrive files with extension of .jpg from directory in vc++ 08.
I have a HTML table as follows. I want retrieve row values from this
I want to retrieve all records from one table when there are no matches
I want to retrive value as below : string server = Request.ServerVariables(SERVER_NAME); //Declare the
I access cassandra from the ruby gem. I want to retrive data from cassandra
i want to retrive some number from string, for example valueID = 234232 or
i want to launch ffmpeg from my app and retrive all console output that
i have stored values in mysql and i want to retrive that value in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.