473,542 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Command timeout

I am pretty sure I am getting a command timeout when execute a SQL
procedure that has an output parameter. The code below is in an asp
page that is called using RSGetASPObject. I want to be able to send a
message back to the calling page to indicate that a timeout has
occurred, but am having a hard time capturing the timeout error. I
intend to set the timeout parameters so that I don't get timeout
errors, but in the case that I would I would like to know that is what
happened. Below is my remote page code that calls the SQL procedure.
Should I have the SQL procedure detect the timeout and send it back
since basically the output parameter is an error message (and how
would I do that?) or would the timeout be caught in the ASP code? (I
thought the "if err.number" code would catch it - but it doesn't
appear to.)

set objCommand = CreateObject("A DODB.Command")
objCommand.Comm andTimeout = 1 'timeout for query
objCommand.Comm andText = "p_svra_compare _report"
objCommand.Acti veConnection = ConnectString
objCommand.Comm andType = adCmdStoredProc

'Input Parameters
objCommand.Para meters.Append objCommand.Crea teParameter("@u ser_id",
adVarChar, adParamInput, 50, strCurrentUser)
objCommand.Para meters.Append
objCommand.Crea teParameter("@c all_type_ind", adVarChar, adParamInput,
5, strCallType)
objCommand.Para meters.Append objCommand.Crea teParameter("@t ab_name",
adVarChar, adParamInput, 50, strTabName)
objCommand.Para meters.Append
objCommand.Crea teParameter("@p age_number", adVarChar, adParamInput,
50, strPageNumber)
'Output Parameters
objCommand.Para meters.Append objCommand.Crea teParameter("@e rrormsg",
adVarChar, adParamOutput, 255)
'Execute command
objCommand.Exec ute
if err.number <> 0 then
strErrMessage = "FALSE!" & Err.Description & "(Source: " &
Err.Source & ")"
CreateReport = strErrMessage
Exit Function
End If
strErrMessage = objCommand.Para meters("@errorm sg").Value
Thank you
Jul 19 '05 #1
4 11522
> objCommand.Comm andTimeout = 1 'timeout for query

Why on earth are you forcing this to be 1 second? Even if you have the most
efficient query in the world (e.g. SELECT 1) you still might go over one
second due to blocking, network activity, other ASP pages, etc. Try
increasing this to a more reasonable value like 10 or 30.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
Aaron Bertrand - MVP wrote:
objCommand.Comm andTimeout = 1 'timeout for query


Why on earth are you forcing this to be 1 second? Even if you have
the most efficient query in the world (e.g. SELECT 1) you still might
go over one second due to blocking, network activity, other ASP
pages, etc. Try increasing this to a more reasonable value like 10
or 30.


I think she's trying to force the timeout to occur so she can see the error
that gets generated.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
Cath B wrote:
I am pretty sure I am getting a command timeout when execute a SQL
procedure that has an output parameter. The code below is in an asp
page that is called using RSGetASPObject.
What is that?
I want to be able to send a
message back to the calling page to indicate that a timeout has
occurred, but am having a hard time capturing the timeout error. I
intend to set the timeout parameters so that I don't get timeout
errors, but in the case that I would I would like to know that is what
happened. Below is my remote page code that calls the SQL procedure.
Should I have the SQL procedure detect the timeout and send it back
since basically the output parameter is an error message (and how
would I do that?) or would the timeout be caught in the ASP code?
The commandtimeout property is not visible to the stored procedure. If a
timeout occurs, it will happen before results are received from the
database, so the output parameter will not contain a value from the
procedure.

The command timeout should be caught by both the vbscript error handler and
the connection's Errors collection. Do you have the ADO documentation? It
can be found at msdn.microsoft. com/library.
(I
thought the "if err.number" code would catch it - but it doesn't
appear to.)

Why not? What happens when you run the code?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #4
cb
Bob,
Thank you for your reply. After you told me that I should get an error
I looked harder at my code and found that I didn't have "on error resume
next" so I added it and did get a message when I force a timeout.

Thanks again.

Cat B

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3097
by: Jawahar Rajan | last post by:
All, I am using ADO to connect to a database to get some data that I then display on my web page. I build the entire script in ASP code the finally use response.write to get the web page itself When I create the connection object set objConn = Server.Create.Object("Server.Command) objConn.Timeout = 90 Even thought I set the time out to...
3
2473
by: rh0dium | last post by:
Hi all, Another newbie question. So you can't use signals on threads but you can use select. The reason I want to do this in the first place it I need a timeout. Fundamentally I want to run a command on another machine, but I need a timeout. I have to do this to a LOT of machines ( > 3000 ) and threading becomes necessary for timeliess....
2
3359
by: twigster | last post by:
Hi, I need to display in real time the output of a command line tool in a GUI written so far with Tkinter and Pmw. I've got a command line tool that I want to integrate to a GUI. The parameters are set using the GUI and a button executes the command. The calc is long so I need to see how fast it goes. This is given by the stdout... any...
8
5777
by: Thierry Lam | last post by:
I can use the python function raw_input() to read any input from the user but how can I add a timeout so that my program exits after x period of time when no input has been entered. Thierry
2
7947
by: John Kotuby | last post by:
Hi all, I have set up a page with a Repeater and a SQLDatasource control, the data control suggested by online Help for use with the Repeater. I am getting Timeout Expired after 30 seconds. I expect many of my queries to take longer than 30 seconds because they are ad hoc user-defined searches through multiple joined tables and associated...
2
10000
by: Gil_H | last post by:
Hi, I'm trying to run a script over unix on a remote machine. In order to automate it, the procedure requests the following: 1. Using SSH connection. 2. Operating a command on the remote machine. 3. Expecting password or (yes/no) request and authorize it. I get an error (I thing that it occures at the last part (3) of the password...
1
2198
by: alexcpn | last post by:
Hi I have a Command class of type class Command { T* m_objptr; void (T::*method)(); : explicit Command(T* pObj,void (T::*p_method)(),long timeout,const
0
2126
by: Omar Abid | last post by:
Reason of this project: The Microsoft.VisualBasic.Interaction class exposes many useful commands and methods that were available in Visual Basic like AppActivate, Beep, Callbyname... This tutorial shows how to work with some of them. Project details: 1- From VB 6.0 to VB .net 2.0 2- Useful interaction commands 3- Samples of interaction...
1
1599
by: priravi | last post by:
Hi, I have a connection timeout of 400 and command timeout of 0 for a stored procedure . the stored procedure retrieves a long data and store it in dataset. I'm getting the "System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." exception...
0
7330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7721
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5246
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
943
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.