开发者

CAML JOINS using SharePoint

开发者 https://www.devze.com 2023-03-26 13:18 出处:网络
Assume that there are Emp and Dept tables. Emp Table has EmpID Firs开发者_Go百科tName LastName DeptName

Assume that there are Emp and Dept tables.

Emp Table has

EmpID
Firs开发者_Go百科tName
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) Are you on SP 2007 or SP 2010 2)On easy approach is create a querystring in SP designer and then show the employee details based on the query string from the URL If doesn't solve your proble then yiu have to take Kyle advice and do it from code and LINQ could be a good way to go

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号