views:

175

answers:

1

Hi,

I need to query all the subsites of a site I m in. I have list called Country which is 2-3 sub level of site my webpart is rendering. My code till now is this.. Country is custom list,DT1 is coming out to be null. I don't know where I m getting wrong , any idea on this?

           SPWeb web = SPContext.Current.Web;

           SPSiteDataQuery qry = new SPSiteDataQuery();
            qry.Lists = "<Lists BaseType='1' />";

            qry.Query = "<Where><Contains><FieldRef Name='Title'/><Value Type='Text'>USA</Value></Contains></Where>";

            qry.ViewFields = "<FieldRef Name='Currency'/>";

             qry.Webs = "<Webs Scope='SiteCollection' />";

           DataTable DT1= web.GetSiteData(qry);
+1  A: 

Veryfi tyat all lists with BaseType='1' has field with internal name Currency or else you will get null as a result.

Janis Veinbergs
I have changed it to <FieldRef Name='Currency' Nullable='TRUE'/> but still result is the same
TSSS22
Actually BaseType is O for generic list and by doing Nullable='TRUE' , I m able to solve my problem. Thanks anyways...
TSSS22
Then answer your question and accept it if you have a solution.
Janis Veinbergs