简体   繁体   中英

CAML JOINS using SharePoint

Assume that there are Emp and Dept tables.

Emp Table has

EmpID
FirstName
LastName
DeptName
Email

Dept table has

DeptID
DeptName

i have to display all the employee details based on DeptName using CAML query. Can some one share CAML JOINS example for this scenario.

Thank you

Check this approach very easy to join as many list as you want: Link

cawl_QueryBuilder cawl = new cawl_QueryBuilder();
cawl.Select("Users_Title");
cawl.Select("Users_Age");
cawl.Select("Users_Sex");
cawl.Select("CarBrand");
cawl.Join("UsersList";"OwnerColumn");
cawl.Get('UserCarsList');

StringBuilder Result = new StringBuilder();
foreach (SPListItem item in cawl.ListItemCollection())
{
  Result.Append(item["Users_Title"].ToString() +
                 item["Users_Age"].ToString() +
                 item["Users_Sex"].ToString() +
                 item["CarBrand"].ToString());

}
Label1.Text = Result .ToString();

1)您使用的是SP 2007还是SP 2010?2)一种简单的方法是在SP设计器中创建查询字符串,然后根据URL中的查询字符串显示员工详细信息。如果不能解决您的问题,那么yiu必须接受凯尔的建议。并通过代码和LINQ做到这一点是一个不错的方法

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM