Avoid enumerating through the SPListItemCollection object as each step will invoke a sparate call to a content database.
Code Snippet:
string siteURL="http://chem.agilent.com";
using (SPSite site=new SPSite(siteURL);
{
using(SPWeb web=site.OpenWeb());
{
SPList tasksList=web.Lists["Tasks"];
DataTable dt=tasksList.Items.GetDataTable();
foreach(DataRow dr in dt.Rows)
{
//Code
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment