• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • 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.
0
rgb192
Asked:
rgb192
3 Solutions
 
FugasCommented:
in php.ini it is max_execution_time in seconds. On MSSQL server I don't think you have the timeout set.
0
 
Kishan ZunjareCommented:
ASP.NET
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

0
 
gery128Commented:
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.
0
 
Kishan ZunjareCommented:
Thanks gery128....good catch.

I think that is correct.
0
 
rgb192Author Commented:
thanks
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

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