Basic query with SPQuery
List<SPListItem> cases = new List<SPListItem>();
SPSite site = Helper.GetDefaultSite();
SPWeb web = site.OpenWeb();
SPList list = web.Lists["myCaseList"];
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='ProblemType'/><Value Type='Text'>6</Value></Eq></Where>";
SPListItemCollection foundItems = list.GetItems(query);
if (foundItems.Count > 0)
foreach (SPListItem item in foundItems)
cases.Add(item);
caseList.Cases = cases;
Inga kommentarer:
Skicka en kommentar