取caml查询结果的前多少行

取查询结果的前多少行的方法?spQuery.RowLimit = 1;
            SPList list = SPContext.Current.Web.Lists[ListNames.CompanyPublicityVideo];
            SPQuery spQuery = new SPQuery();
            spQuery.Query = string.Format(@"
                                          <Where>
                                          <Eq>
                                             <FieldRef Name='ID' />
                                             <Value Type='Counter'>" + ID + @"</Value>
                                          </Eq>
                                       </Where>");
            spQuery.ViewAttributes = "scope='Recursive'";
            spQuery.ViewFields = @"<FieldRef Name='ID'/>
                                   <FieldRef Name='VideoPath' />";
            spQuery.RowLimit = 1;
            SPListItemCollection items = list.GetItems(spQuery);

posted on 2013-12-27 09:14  木子叶  阅读(201)  评论(0编辑  收藏  举报

导航