Solved

query using php or asp.net

Posted on 2011-09-17
5
156 Views
Last Modified: 2012-05-12
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
Comment
Question by:rgb192
5 Comments
 
LVL 4

Accepted Solution

by:
Fugas earned 167 total points
ID: 36555666
in php.ini it is max_execution_time in seconds. On MSSQL server I don't think you have the timeout set.
0
 
LVL 7

Assisted Solution

by:Kishan Zunjare
Kishan Zunjare earned 167 total points
ID: 36555835
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
 
LVL 9

Assisted Solution

by:gery128
gery128 earned 166 total points
ID: 36567108
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
 
LVL 7

Expert Comment

by:Kishan Zunjare
ID: 36567187
Thanks gery128....good catch.

I think that is correct.
0
 

Author Closing Comment

by:rgb192
ID: 36595668
thanks
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now