TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abraham Olatubosun
NA
471
113.6k
How To Get The Value of XDocument Using C#
Nov 24 2016 5:34 AM
Hi My Code Masters,
Trust you all are doing just fine.
Please I want to get the Values of this Element
<PrescribedRegimenTypeCode>ART</PrescribedRegimenTypeCode>
from my XML files if the vale is ART i will then count Regimen else i will not. so i use this code
int
RegimenCounter
=
0
;
string
result
=
""
;
if(!string.IsNullOrEmpty(
result
=
xd
.Descendants("PrescribedRegimenTypeCode").Single().Value))
{
if (
result
== "ART")
{
RegimenCounter
=
xd
.Descendants("Regimen").Count();
}
}
when i execute the code i am getting an exception error
"Sequence Contain no Element"
. it because the first XML file does not contain that Element
"PrescribedRegimenTypeCode"
while other files have in them.
please i need your help to resolve this challenge.
thank you
Reply
Answers (
5
)
Create windows application for file download from FTP Server
Assign the dateTimePicker control to the datagridView cell