423,516 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,516 IT Pros & Developers. It's quick & easy.

Timeout expired

P: 41
My ASP page is calling a Stored Procedure,it will take around 70 to 100 seconds to execute.I am getting timeout error in my ASP page.

I already put
Server.ScriptTimeout = 3600

Microsoft OLE DB Provider for SQL Server (0x80040E31)
Timeout expired

Please Advice....

Thanks
Aug 15 '07 #1
Share this Question
Share on Google+
4 Replies


ilearneditonline
Expert 100+
P: 130
My ASP page is calling a Stored Procedure,it will take around 70 to 100 seconds to execute.I am getting timeout error in my ASP page.

I already put
Server.ScriptTimeout = 3600

Microsoft OLE DB Provider for SQL Server (0x80040E31)
Timeout expired

Please Advice....

Thanks
The problem is that the connection to the SQL server is timing out, not the script. You need to define a timeout on your command or maybe your connection.

Expand|Select|Wrap|Line Numbers
  1. Dim conn
  2. Set conn = Server.CreateObject("ADODB.Connection")
  3. conn.ConnectionString = "Your ConnectionString"
  4. conn.ConnectionTimeout = 120 'number of seconds
Or if you are using a command object

Expand|Select|Wrap|Line Numbers
  1. Dim cmd
  2. Set cmd = Server.CreateObject("ADODB.Command")
  3. cmd.CommandTimeout = 120 ' number of seconds
Aug 15 '07 #2

P: 2
My ASP page is calling a Stored Procedure,it will take around 70 to 100 seconds to execute.I am getting timeout error in my ASP page.

I already put
Server.ScriptTimeout = 3600

Microsoft OLE DB Provider for SQL Server (0x80040E31)
Timeout expired

Please Advice....

Thanks
In calling your stored procedure set the CommandTimeout = (and the number of seconds you need such as 120)
Aug 17 '07 #3

jhardman
Expert 2.5K+
P: 3,401
Although I have on occasion timed out on long procedures (emailing in particular) I am much more likely to time out when a loop isn't advancing. I have noticed that this happens in even fairly well-formed code when an error causes the loop to not advance but I have included an error handler which keeps the script executing. I don't know if this will help...

Jared
Aug 17 '07 #4

ilearneditonline
Expert 100+
P: 130
In calling your stored procedure set the CommandTimeout = (and the number of seconds you need such as 120)
server.scripttimeout has no effect on the stored procedure. that is how long before a script on the page times out. If you have a stored procedure you know takes 70-100 seconds to timeout, you need to make sure that your command object to the database doesn't timeout before the sp can finish.
Aug 18 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.