• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

query using php or asp.net

is there a setting to extend timeout on query using php or asp.net

I want query to run for long time because I am getting timeout error.
3 Solutions
in php.ini it is max_execution_time in seconds. On MSSQL server I don't think you have the timeout set.
Kishan ZunjareSr. Software EngineerCommented:
A sqlConnection has a ConnectionTimeout property. It  is a property which determines the maximum number of seconds your code will wait for a connection to the database to open. It is set in the connectionstring to the database

data source=BROCHIS;initial catalog=Indato;integrated security=SSPI;Connect Timeout=60;

Opening the connection does not do anything in the database yet. That is handled by a SqlCommand, By default this is 30 seconds. When you perform something costly in the database this is the one whose value you’ll have to change.

SqlCommand cmd;

cmd.CommandTimeout = 60;

Hope this will work

As correctly pointed out by Kishanzunjare, you need to set ConnectionTimeout property of SqlCommand object should be set as well as Connect Timeout parameter in connectionstring. If you set these properties to 0 (zero), it will execute for indefinate time, which is not recommended.
Kishan ZunjareSr. Software EngineerCommented:
Thanks gery128....good catch.

I think that is correct.
rgb192Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now