Stored procedure execution time out problem

I have created a stored procedure.When i execute it in query analyzer it takes 47 sec. So my web application throwing Timeout exception. Can we do any modification in my code or web.config file instead of doing changes in stored procedure to resolve this problem.

I have following settings in my config file

<sessionState mode="StateServer" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes" cookieless="false" timeout="120"/>

My Code is:

Dim ds = New DataSet()
        _dbCommand = _database.GetStoredProcCommand("GetDetailsForAll")
        _dbCommand.CommandType = CommandType.StoredProcedure
        ds = _database.ExecuteDataSet(_dbCommand)

here if i add one more line :

_dbCommand.CommandTimeout = 120

then my problem solved. so my question is i have set timeout in web.config file. Do i need to add _dbCommand.CommandTimeout = 120 line in my code also.


New answer based on updated question

The timeout in the connection string property in the .config file is the connection timeout, not the command timeout. The connection timeout is the amount of time to wait for the SQL Server to initially respond to the connection, not the amount of time it takes to perform the query.

If you want to set a command timeout in the config file, you have to code that youself as it is not part of the connection string.

Need Your Help

Red status bar showing when not recording and app in background

ios ios4 ios5 statusbar

I'm having a problem with the status bar on an app which does sound recording. I've got

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.