Right, start losing your mind here. I have the following code:
var query = (from c in db.Descendants("Customer")
select c.Elements());
dgvEditCusts.DataSource = query.ToList();
In this case, db refers to the call to XDocument.Load. How can I get data in a DataGridView?
Just thought I should mention: it returns a completely empty dgv.
Not that XML was too big, but here is an example:
<Root>
<Customer>
<CustomerNumber>1</CustomerNumber>
<EntryDate>2010-04-13T21:59:46.4642+01:00</EntryDate>
<Name>Customer Name</Name>
<Address>Address</Address>
<PostCode1>AB1</PostCode1>
<PostCode2>2XY</PostCode2>
<TelephoneNumber>0123456789</TelephoneNumber>
<MobileNumber>0123456789</MobileNumber>
<AlternativeNumber></AlternativeNumber>
<EmailAddress>email@address.com</EmailAddress>
</Customer>
</Root>
source
share