LINQ-to-SQL Query Timing Out

Posted by kevinw on Stack Overflow See other posts from Stack Overflow or by kevinw
Published on 2009-07-08T20:30:25Z Indexed on 2010/04/12 20:03 UTC
Read the original article Hit count: 324

Filed under:

I'm running this query in LINQ:

var unalloc = db.slot_sp_getUnallocatedJobs("Repair", 
                  RadComboBox1.SelectedValue, 20);

It runs when I first open the page, but when I go back to it and try to run the same query with a different value, "Con", being passed through, the linq to sql designer.cs tells me that I've got a timeout error.

Any ideas?

Edit: This is what's in the designer:

[Function(Name="dbo.slot_sp_getUnallocatedJobs")]
Public ISingleResult<slot_sp_getUnallocatedJobsResult> slot_sp_getUnallocatedJobs([Parameter(Name="JobType", DbType="VarChar(20)")] string jobType, [Parameter(Name="Contract", DbType="VarChar(10)")] string contract, [Parameter(Name="Num", DbType="Int")] System.Nullable<int> num)
    	{
    		IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), jobType, contract, num);
    		return ((ISingleResult<slot_sp_getUnallocatedJobsResult>)(result.ReturnValue));
    	}
    }

This is the error:

SQLException was unhandled by user code
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

© Stack Overflow or respective owner

Related posts about linq-to-sql