G
Guest
Hi all,
I have a xml document which contains:
<users>
<user id="000000126836">
<loginname>Bart</loginname>
</user>
<user id="600000126836">
<loginname>Piet</loginname>
</user>
</users>
Now I want to retreive just one user with a certain id. I have tried this
code but it doesn't retreive anything.
public string GetLoginName(string buttonID)
{
XDocument userList = XDocument.Load("users.xml");
var query =
from users in userList.Descendants("user")
where (string)users.Attribute("id") == buttonID
select new
{
loginname = (string)users.Element("loginname"),
};
return ?????????
}
Now my question is what is wrong with my query and how can i return the
Login
Thanks in advance,
Bart
I have a xml document which contains:
<users>
<user id="000000126836">
<loginname>Bart</loginname>
</user>
<user id="600000126836">
<loginname>Piet</loginname>
</user>
</users>
Now I want to retreive just one user with a certain id. I have tried this
code but it doesn't retreive anything.
public string GetLoginName(string buttonID)
{
XDocument userList = XDocument.Load("users.xml");
var query =
from users in userList.Descendants("user")
where (string)users.Attribute("id") == buttonID
select new
{
loginname = (string)users.Element("loginname"),
};
return ?????????
}
Now my question is what is wrong with my query and how can i return the
Login
Thanks in advance,
Bart