<p>I have a long running SQL statement that I want to run, and no matter what I put in the "timeout=" clause of my connection string, it always seems to end after 30 seconds.  </p>

<p>I'm just using <code>SqlHelper.ExecuteNonQuery()</code> to execute it, and letting it take care of opening connections, etc.</p>

<p>Is there something else that could be overriding my timeout, or causing sql server to ignore it? I have run profiler over the query, and the trace doesn't look any different when I run it in management studio, versus in my code.</p>

<p>Management studio completes the query in roughly a minute, but even with a timeout set to 300, or 30000, my code still times out after 30 seconds.</p>

[{'answer_id': 27473, 'author': 'Matt Hamilton', 'author_id': 615, 'author_profile': 'https://Stackoverflow.com/users/615', 'pm_score': 6, 'selected': True, 'text': '<p>What are you using to set the timeout in your connection string? From memory that\'s "ConnectionTimeout" and only affects the time it takes to actually <em>connect</em> to the server.</p>\n\n<p>Each individual command has a separate "CommandTimeout" which would be what you\'re looking for. Not sure how SqlHelper implements that though.</p>\n'}, {'answer_id': 27477, 'author': 'Ishmaeel', 'author_id': 227, 'author_profile': 'https://Stackoverflow.com/users/227', 'pm_score': 4, 'selected': False, 'text': '<p><s>In addition to timeout in connection string,</s> try using the timeout property of the SQL command. Below is a C# sample, using the SqlCommand class. Its equivalent should be applicable to what you are using.</p>\n\n<pre><code>SqlCommand command = new SqlCommand(sqlQuery, _Database.Connection);\ncommand.CommandTimeout = 0;\nint rows = command.ExecuteNonQuery();\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/27472', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/489/']