本文介绍了spquery foreach无法正常工作,但出现异常.身体可以帮我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






SPSite osite = SPContext.Current.Site;
           SPWeb Oweb = osite.OpenWeb();
           Oweb.AllowUnsafeUpdates = true;
           SPList olist = Oweb.Lists["Documents"];

           //SPList extInfo = Oweb.GetListFromUrl("/Forms/ResultView.aspx");

           //SPView srcView = extInfo.Views["ResultView"];
           SPQuery query = new SPQuery();
           query.RowLimit = 30;
           query.ViewFields = generateQueryFields();
           query.Query = generateQueryValues();
           SPListItemCollection collListItems = olist.GetItems(query);

           string resultid = "";
           string resultscandate = "";
           string resultscostumers = "";
           string resultdescription = "";
           string resulttechician = "";
           string resultcontactbycostumer = "";
           string resultcontenttype = "";
           string resultcreatedate = "";

           foreach (SPListItem oListItem in collListItems)
           {

             resultid += oListItem["ID"].ToString();
               resultscandate += oListItem["Scandate"];
             resultscostumers += oListItem["Costumers"];
             resultcontactbycostumer += oListItem["Costumers_x003a__x0020_YomiFullName"];
             resultdescription += oListItem["Document Description"];
              resulttechician += oListItem["Technician"];
              resultcontenttype += oListItem["ContentType"];
             resultcreatedate += oListItem["Created"];

           }

           string totaalresult = resultid + "<BR>"
               + resultscandate + "<BR> " +
              resultcontactbycostumer + "<BR>" +
               resultscostumers + "<BR>" +
               resultdescription + "<BR>" +
               resulttechician + "<BR>" +
               resultcontenttype + "<BR>" +
               resultcreatedate;

           Label6.Text = totaalresult;


<Query />

推荐答案


这篇关于spquery foreach无法正常工作,但出现异常.身体可以帮我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:10