Skip to main content
Home Forums General Silverlight Installation and Setup Error - object reference not set to an instance of an object
1 replies. Latest Post by Brennca3344 on June 17, 2009.
(0)
bhat555
Member
0 points
1 Posts
06-16-2009 12:37 AM |
Hi
I am getting error 'object reference not set to an instance of an object' when using following code to retrieve data from SharePoint list
Xnamespace ns = "#RowsetSchema";
var query = from x in e.Result.Descendants()
where x.Name == ns + "row"
select x.Attribute("ows_BrandName").Value;
but when I am using following code i.e without 'Value' it works & display ows_BrandName = 'Pepsodent'
select x.Attribute("ows_BrandName");
Can someone tell me what's wronge with the first code block? How to get ony value part ?
Thanks
Brennca3344
28 points
5 Posts
06-17-2009 7:49 PM |
Perhaps try setting a properly typed variable = x.Attribute("ows_BrandName"), and then try "select variable.Value", something like this (I'm not sure what type x is):
var result = x.Attribute("ows_BrandName")
select result.Value;