遇到多个list联合查询的有关问题,where条件来自多个表
遇到多个list联合查询的问题,where条件来自多个表
遇到多个list联合查询的问题,需要用CAML做到类似于SQL中的:
select A.*,A.CityID,B.CityNAME from tableA A left join tableB B on A.CityID=B.ID where tableA .Name=xxx or tableB.CityName=xxx or....
SPSiteDataQuery siteQuery = new SPSiteDataQuery();
siteQuery.Webs = "<Webs Scope=\"SiteCollection\" />";
siteQuery.Lists = string.Format("<Lists><List ID='{0}' /><List ID='{1}' /></Lists>", web.Lists["员工信息表"].ID, web.Lists["Hitech通讯录"].ID);
siteQuery.ViewFields = string.Format("<FieldRef Name='{0}' Nullable=\"TRUE\" /><FieldRef Name='{1}' Nullable=\"TRUE\" /><FieldRef Name='{2}' Nullable=\"TRUE\" /><FieldRef Name='{3}' Nullable=\"TRUE\" /><FieldRef Name='{4}' Nullable=\"TRUE\" /><FieldRef Name='{5}' Nullable=\"TRUE\" /><FieldRef Name='{6}' Nullable=\"TRUE\" />",
web.Lists["员工信息表"].Fields["姓名"].InternalName, web.Lists["员工信息表"].Fields["拼音"].InternalName,
web.Lists["员工信息表"].Fields["员工部门"].InternalName, web.Lists["员工信息表"].Fields["员工科室"].InternalName,
web.Lists["Hitech通讯录"].Fields["短号"].InternalName, web.Lists["Hitech通讯录"].Fields["手机号"].InternalName, web.Lists["Hitech通讯录"].Fields["座机"].InternalName);
siteQuery.RowLimit = 10;
string queryStr = string.Format(@"<Where>
<Or>
<Or>
<Or>
遇到多个list联合查询的问题,需要用CAML做到类似于SQL中的:
select A.*,A.CityID,B.CityNAME from tableA A left join tableB B on A.CityID=B.ID where tableA .Name=xxx or tableB.CityName=xxx or....
SPSiteDataQuery siteQuery = new SPSiteDataQuery();
siteQuery.Webs = "<Webs Scope=\"SiteCollection\" />";
siteQuery.Lists = string.Format("<Lists><List ID='{0}' /><List ID='{1}' /></Lists>", web.Lists["员工信息表"].ID, web.Lists["Hitech通讯录"].ID);
siteQuery.ViewFields = string.Format("<FieldRef Name='{0}' Nullable=\"TRUE\" /><FieldRef Name='{1}' Nullable=\"TRUE\" /><FieldRef Name='{2}' Nullable=\"TRUE\" /><FieldRef Name='{3}' Nullable=\"TRUE\" /><FieldRef Name='{4}' Nullable=\"TRUE\" /><FieldRef Name='{5}' Nullable=\"TRUE\" /><FieldRef Name='{6}' Nullable=\"TRUE\" />",
web.Lists["员工信息表"].Fields["姓名"].InternalName, web.Lists["员工信息表"].Fields["拼音"].InternalName,
web.Lists["员工信息表"].Fields["员工部门"].InternalName, web.Lists["员工信息表"].Fields["员工科室"].InternalName,
web.Lists["Hitech通讯录"].Fields["短号"].InternalName, web.Lists["Hitech通讯录"].Fields["手机号"].InternalName, web.Lists["Hitech通讯录"].Fields["座机"].InternalName);
siteQuery.RowLimit = 10;
string queryStr = string.Format(@"<Where>
<Or>
<Or>
<Or>