sql server - Stored procedure execution time out problem -
i have created stored procedure.when execute in query analyzer takes 47 sec. web application throwing timeout exception. can modification in code or web.config file instead of doing changes in stored procedure resolve problem.
i have following settings in config file
<sessionstate mode="stateserver" stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1;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 add 1 more line :
_dbcommand.commandtimeout = 120
then problem solved. question have set timeout in web.config file. need add _dbcommand.commandtimeout = 120 line in code also.
new answer based on updated question
the timeout in connection string property in .config file connection timeout, not command timeout. connection timeout amount of time wait sql server respond connection, not amount of time takes perform query.
if want set command timeout in config file, have code youself not part of connection string.
Comments
Post a Comment