score:16
If table C and D contain a lot of rows, it may just be taking longer to run the insert than the default command timeout (30 seconds). Add this line before your insert command:
context.CommandTimeout = 240 // set timeout to 4 minutes
By the way, you should be disposing of the context when you have finished with it. The easiest way to do this is:
using (Datacontext context = new Datacontext())
{
// your code goes here
}
Source: stackoverflow.com
Related Articles
- ExecuteQueryin linq :Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
- Getting Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. .exception
- Getting exception Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- Sometimes get Timeout expired exception with Linq to EF and after a restart of server, it works fine
- Comparing code prior to LINQ
- source code for LINQ 101 samples
- How to divide a LINQ query in small group to avoid Timeout expired exception?
- c# Linq or code to extract groups from a single list of source data
- The timeout period ... IN LINQ C#
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Linq code to select one item
- How are people unit testing code that uses Linq to SQL
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Syntax to execute code block inside Linq query?
- Linq to SQL count grouped elements generating a timeout
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Best open source LINQ provider
- Is there a good source that gives an overview of linq optimizations?
- Does this LINQ code perform multiple lookups on the original data?
- How to understand the following C# linq code of implementing the algorithm to return all combinations of k elements from n
- LINQ WHERE method alters source collection
- Where can I view LINQ source code?
- Suggestions for designing complex LINQ code
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Left outer join using LINQ -- understanding the code
- How to pass LinQ Expressions from F# to C# code
- How to reuse a linq expression for 'Where' when using multiple source tables
- how to use LINQ to find an object in csv file
- Data Transfer Object (DTO) to DisplayObject (DO) - How to flatten DTO's into a DO collection property
- Using LINQ in Visual Studio while debugging
- How to change linq to include href of a table cell when scraping a Table using htmlagilitypack
- How to convert type 'byte[]' to 'System.Data.Linq.Binary'
- Trouble understanding LINQ return value
- Linq group by and order by create date
- LINQ Multiple Insertion
- Linq To Entities question
- SQL query in LINQ
- Find XmlNode where attribute value is contained in string
- Select every second element from array using lambda
- Return String instead of DateTime if LINQ Query NULL
- How to convert a list of dictionaries into IDictionary “C#”
- Conditional Calc of Time Distance While performing a Linq Query
- C# Linq - Refactoring ForEach Loop with Sub List
- How to join with an or clause in Fluent LINQ
- Linq left outer join with multiple condition
- Generate missing list values in c# list using Linq
- Caching when using Query Expressions?