Rajkiran Swain

Rajkiran Swain

  • 29
  • 40.7k
  • 3.2m

How to Increase the Performance of a List in Sharepoint ?

Jun 26 2015 8:30 AM
Dear All,
 
Please tell me the Solution.
 
I have a List having more than 5000 record and When I am Going to Fetch all record from list I Have getting Error like this.
 
Web Part Error: Sandboxed code execution request failed. Correlation ID: 1b20149d-a096-2000-1387-e36b01d5c688. 
 
That's why I  have used  
 
private void SearchClients()
{
try
{
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
using (SPWeb sweb = site.OpenWeb())
{
SPList spList = sweb.Lists["Project Details"];
spList.EnableThrottling = true;
SPQuery oQuery = new SPQuery();
oQuery.Query = "<Where><Contains><FieldRef Name='Client'/>" +
"<Value Type='Text'>" + txtClient.Text.Trim() + "</Value></Contains></Where>";
oQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
oQuery.RowLimit = 3000;
SPListItemCollection coll = spList.GetItems(oQuery);
dt = coll.GetDataTable();
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message;
}
 
Again I have facing some problem Means Some time it's Working Fine and Some time I have got same Error .
I don't Know why it's Coming again and again please tell me the solution .
How to Increase the Performance of this List ? 
 

Answers (9)