SQLCommandTimeout

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I am running into query timeouts in my ASP.NET web application and need some
help. I found out about the SQLCommandTimeout Property that can be used to
reset to extent the timeout period past the default 30 seconds. Since my
DataSource is filled using the designer settings, I have no ADO.NET code in
my application and therefore I have no SQLCommand to reset the value in. So I
am using the web.config file, specifically the SessionState section, to set
SqlCommandTimeout to 180 seconds, or 3 Minutes. I know my stored procedure
needs about 2:30 minutes to return the largest data set we have at this time
so 3 minutes should be plenty of time.

Next I added some code in my code behind (in C#) to get and output the
SqlCommandTimeout value in my page_load handler. It is set to 3:00 minutes as
expected. But, things are not working as expected and described.

When I submit my page using settings that result in the large data set to be
returned, the query times out...in exactly 30 seconds! I timed it several
times. It is behaving as if the setting was never changed and/or the setting
is ignored.

Can someone here tell me what I am doing wrong and/or misunderstanding? If
that is not possible, can you suggest a work-around other than writing the
code to load the dataset myself? I know I can do that, but would like to
avoid it if I can unless I know for sure that will solve the problem.

We are using Visual Studio 2005, Professional under Windows XP Pro, SP 2.
Framework is 2.0 of course and the RDBMS is SQLServer 2000.

I look forward to reading your replies.

TIA
Ute
 
The SessionState doesn't have anything to do with the SQL Command timeout of
your stored proc.

Even though you've configured the datasource via the designer, there is
still ADO.NET code somewhere.

If you are using an SQLCommand component (dragged onto the form in the
designer) you can set the Command Timeout value there.
 
Brendan Green said:
The SessionState doesn't have anything to do with the SQL Command timeout of
your stored proc.

I assumed by setting that property I was setting the SQL time out for the
session. Obviously, that is not the case. So what is the property for ifnot
to set the value for the session?
Even though you've configured the datasource via the designer, there is
still ADO.NET code somewhere.

I figured that, but I can't find it. Besides, it would be regenerated and
over written when I change something on the page.
If you are using an SQLCommand component (dragged onto the form in the
designer) you can set the Command Timeout value there.

I am just using the DataSource, configured to use my stored procedure,
nothing else.

I suppose I can add the command, configure the datasource to use that and
set the timeout property of the command. That is one step from laoding the
DataSource myself though. Surely there is a way to set the timeout property
without doing that, isn't there?

Thanks
Ute
 
Back
Top