SPList productsList = SPContext.Current.Web.Lists[ "Products" ]; |
SPQuery query = new SPQuery(); |
query.Query = "<Where><Eq>" + |
"<FieldRef Name='AvailableColors' LookupId='TRUE' />" + |
"<Value Type='Lookup'>1</Value>" + |
"</Eq></Where>" ; |
SPListItemCollection results = productsList.GetItems(query); |
这个例子用的是Eq,能否实现Contains的效果需要测试(某一Item的AvailableColors包含多个值[e.g. 1 5 9],这个Query能否查到这个Item)