SQL Server Command Timeout

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/19/2010 2:19:04 PM
Gravatar
Total Posts 131

SQL Server Command Timeout

I have a long running procedure (about 25 seconds) that is timing out. I get the error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"

Is there an easy way to up the command timeout for all procedures using SQLParameterHelper? I switched to a straight SQL command but would like to keep using parameter helper.

Thanks

 

11/20/2010 6:21:14 AM
Gravatar
Total Posts 18439

Re: SQL Server Command Timeout

Hi David,

I think you can set the connection timeout in the connection string like 

Connection Timeout=30;

the default is 15 seconds

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring%28VS.71%29.aspx

You could create an alternate connection string and use it just for the long running things.

Best,

Joe

11/20/2010 7:39:26 AM
Gravatar
Total Posts 131

Re: SQL Server Command Timeout

Actually Joe, you can only set the connection timeout (time it takes to connect to db) in the querystring. May be something you want to add to the SQLParameterHelper to allow a passthrough of the commandtimeout if necessary.

Was easy enough to bypass the SPH, and it's only called infrequently so I don't need caching, but somebody may. But I guess if a query runs over 15 seconds it shouldn't be used for a standard web page anyway.

 

 

11/20/2010 8:14:44 AM
Gravatar
Total Posts 18439

Re: SQL Server Command Timeout

Hi David,

Ok, I've added overloads to ExecuteNonQuery, ExecuteReader, and ExecuteScalar to allow passing in a command timeout.

You can get it from the repository now.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.