query语句查询,and和or组合

 

 SPQuery query = new SPQuery();
                query.Query = @"<Where>
                                      <And>
                                         <And>
                                            <Eq>
                                               <FieldRef Name='Over_x0020_Due' />
                                               <Value Type='Choice'>ture</Value>
                                            </Eq>
                                            <Eq>
                                               <FieldRef Name='Responsible' />
                                               <Value Type='User'>" + ResName + @"</Value>
                                            </Eq>
                                         </And>
                                         <Or>
                                           <Eq>
                                            <FieldRef Name='Device_x0020_Status' />
                                            <Value Type='Choice'>在用Active</Value>
                                           </Eq>
                                           <Eq>
                                            <FieldRef Name='Device_x0020_Status' />
                                            <Value Type='Choice'>限用Limited</Value>
                                         </Eq>
                                         </Or>
                                      </And>
                                   </Where>";

                query.ViewAttributes = "Scope=\"RecursiveAll\"";  //可查询子文件夹里边的内容

你可能感兴趣的:(query)