Command timeout

M

milop

Hello.

I'm running a stored procedure and have set the CommandTimeout property to
60.

After 60 seconds the command still runs.

Is there a way to set a timeout on the thread that is executing the
ExecuteNonquery() statement?

Thanks in advance,

Mike
 
N

NitRaGs

Hi Mike,
Are you facing any time out errors? or you don't want command to run beyond
60 seconds?

Thanks
Nitin
 
M

milop

Exactly. I'm using IBM's provider to an AS/400. The CommandTimeOut property
is not used as an actual timeout. It is ignored in .Net, so I need to find
another way.

Here is an explanation from their Programmer's Toolkit:

CommandTimeout is an Int32 value indicating the longest allowed execution
time for a command. Because the iSeries host server does not have a true
timeout, the host optimizing algorithms estimate how long the command will
take to finish. If the estimate is larger than the CommandTimeout, the
command will not be attempted. Instead, an error is generated. If the host
estimates the command can complete within the time specified by
CommandTimeout, the command is executed.

The special value of 0 for CommandTimeout is used to indicate no limit.
When executing a command using a CommandTimeout of 0, the command is always
executed.

Because the CommandTimeout is not a true timeout, setting the CommandTimeout
property has no affect on the length of time a command executes. Rather, it
is used only to tell the host whether it should attempt to execute the
command, or return immediately with an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top