472,784 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

ASP + SQL Server - Timeout Expired

Hello

In my ASP page I am trying to ascertain whether a randomly generated ID starts with certain characters that are not allowed or has been used before.

When the SQL statement for latter is executed I get:

Microsoft OLE DB Provider for SQL Server error '80040e31'

Timeout expired

/Admin/Start2WaySMS.asp, line 52

This is most bizarre because I have already executed two SQL statements prior to this on the same connection object, both of which execute successfully.

Also, this is only happening on my production server and not my staging server. Both servers are at the same MDAC revision and SQL Server 2000 SP3.

This is the ASP code that is being executed:

bSessionIDOK = False

Do While Not bSessionIDOK

stSessionID = Generate2WaySessionID

If objConn.Execute("SELECT Keyword FROM dbo.tblReservedKeywords WHERE (Keyword = " & DbString(Left(stSessionID, 2)) & ")", , adCmdText).EOF & _
And objConn.Execute("SELECT SessionID FROM dbo.tbl2WaySessions WHERE (SessionID = " & DbString(stSessionID) & ")", , adCmdText).EOF & _
Then bSessionIDOK = True

Loop

The line that reports the error is where the second statement is executed.

I have watched this execute using SQL Profiler and nothing untoward is reported, save a sp_reset_connection immediately after the second statement appears. Most statements have about four lines in profiler that have the same text and different event classes. e.g. SQL:BatchStarting, SQL:StmtStarting, SQL:StmtCompleted and SQL:BatchCompleted. All that is reported for the statement in error is: SQL:BatchCompleted, Attention and RPC:Completed.

Naturally, I have run the statements themselves in Query Analyzer and they both execute with no problems. One thing I should mention is that there are no records in tbl2WaySessions. (I know that if I was using a stored procedure I would get a closed recordset, not EOF.)

I have also changed my code to assign the objConn.Executes to recordset variables and then test their EOFs (closing the first one before opening the second) and exactly the same thing happens.

I have tried closing and opening the connection before the loop starts, and setting the cursor location to be adUseServer. Normally I don't set anything so it will be using the defaults of ReadOnly and ForwardOnly.

I have changed the problematic statement into a stored procedure that returns 1 or 0 and tested for that value and again I get the same time out error.

Create Procedure usp_IsUniqueSessionID
(
@SessionID char(16)
)
As
set nocount on
DECLARE @Result int
if EXISTS(SELECT SessionID FROM dbo.tbl2WaySessions WHERE (SessionID = @SessionID))
BEGIN
SET @Result = 1
END
else
SET @Result = 0

SELECT 'IsUniqueSessionID' = @Result
return

I have run sp_Who2 and there is no blocking.

I am sure I have missed something stupid but cannot figure it out. Any help would be much appreciated. Just off to check that SessionID is not a reserved word or something... which it isn't.

David M

P.S. Apologies for posting in HTML but I am using Outlook Express and I know a plain text version will also be available for those with down-level news readers and those accessing via a website. Hopefully this will be more readable for those viewing this with software released this century.

Jul 19 '05 #1
3 19751
Just a suggestion but the reference to adCmdText - have you got the necessary reference in the adovbs file?

Jack
__________________________________________________ _________________
Remotely manage MS SQL db with SQLdirector - www.ciquery.com/tools/sqldirector/
"David Morgan" <da***@davidmorgan.me.uk> wrote in message news:#I*************@TK2MSFTNGP12.phx.gbl...
Hello

In my ASP page I am trying to ascertain whether a randomly generated ID starts with certain characters that are not allowed or has been used before.

When the SQL statement for latter is executed I get:

Microsoft OLE DB Provider for SQL Server error '80040e31'

Timeout expired

/Admin/Start2WaySMS.asp, line 52

This is most bizarre because I have already executed two SQL statements prior to this on the same connection object, both of which execute successfully.

Also, this is only happening on my production server and not my staging server. Both servers are at the same MDAC revision and SQL Server 2000 SP3.

This is the ASP code that is being executed:

bSessionIDOK = False

Do While Not bSessionIDOK

stSessionID = Generate2WaySessionID

If objConn.Execute("SELECT Keyword FROM dbo.tblReservedKeywords WHERE (Keyword = " & DbString(Left(stSessionID, 2)) & ")", , adCmdText).EOF & _
And objConn.Execute("SELECT SessionID FROM dbo.tbl2WaySessions WHERE (SessionID = " & DbString(stSessionID) & ")", , adCmdText).EOF & _
Then bSessionIDOK = True

Loop

The line that reports the error is where the second statement is executed.

I have watched this execute using SQL Profiler and nothing untoward is reported, save a sp_reset_connection immediately after the second statement appears. Most statements have about four lines in profiler that have the same text and different event classes. e.g. SQL:BatchStarting, SQL:StmtStarting, SQL:StmtCompleted and SQL:BatchCompleted. All that is reported for the statement in error is: SQL:BatchCompleted, Attention and RPC:Completed.

Naturally, I have run the statements themselves in Query Analyzer and they both execute with no problems. One thing I should mention is that there are no records in tbl2WaySessions. (I know that if I was using a stored procedure I would get a closed recordset, not EOF.)

I have also changed my code to assign the objConn.Executes to recordset variables and then test their EOFs (closing the first one before opening the second) and exactly the same thing happens.

I have tried closing and opening the connection before the loop starts, and setting the cursor location to be adUseServer. Normally I don't set anything so it will be using the defaults of ReadOnly and ForwardOnly.

I have changed the problematic statement into a stored procedure that returns 1 or 0 and tested for that value and again I get the same time out error.

Create Procedure usp_IsUniqueSessionID
(
@SessionID char(16)
)
As
set nocount on
DECLARE @Result int
if EXISTS(SELECT SessionID FROM dbo.tbl2WaySessions WHERE (SessionID = @SessionID))
BEGIN
SET @Result = 1
END
else
SET @Result = 0

SELECT 'IsUniqueSessionID' = @Result
return

I have run sp_Who2 and there is no blocking.

I am sure I have missed something stupid but cannot figure it out. Any help would be much appreciated. Just off to check that SessionID is not a reserved word or something... which it isn't.

David M

P.S. Apologies for posting in HTML but I am using Outlook Express and I know a plain text version will also be available for those with down-level news readers and those accessing via a website. Hopefully this will be more readable for those viewing this with software released this century.

Jul 19 '05 #2

Please don't multipost. It's going to very difficult to
follow this conversation in two newsgroups. Since it's a
database-related question, let's carry on the conversation
over in asp.db where I've already posted two replies.

Thank you.
Jul 19 '05 #3
Sorry, but at the risk of double posting, I thought it valuable to add an entry to this post as I could not locate the other mentioned and Google brought me straight here in the first place.

Here is what I have found out in case anyone else is having similar issues.

I had experienced issues with a store proc executing very quickly in Query Analyzer, but not from my ASP app against a development database. I noticed recently the same issue with the procedure not executing quickly in either QA or the web app.

After checking my table indexes on the dev database I found one joined table that had no index for the fields I was joining on. The index existed in the production database. Once adding that index the procedure executed in < 1 second in QA and only a couple seconds from the web app.

Hope this helps anyone who's frustrated with similar issues.

Dave
Jun 14 '06 #4

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

Similar topics

3
by: Hasan | last post by:
Hi I'm having a problem with deadlocks in a table in SQL server when trying to update it through Biztalk 2004. There is no problem when I use the same Biztalk solution to update a similar dummy...
4
by: Nick | last post by:
Hi I am a little stuck. I have a web app which uses cookieless session management. I would like to inform a user when their session has ended but cannot work out how to implement. I thought...
0
by: Ersin Gençtürk | last post by:
we are getting : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period...
1
by: Dale | last post by:
Hi, I encountered this error when I debug my asp.net web application. What might be the reason? How can I resolve this? Thanks! Server Error in '/ETS' Application....
3
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
4
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying...
1
by: Ron | last post by:
Hi, I had a stored procedure on SQL 2000 server to run calculation with large amount of data. When I called this stored procedure via System.Data.SqlClient.SqlCommand on production, i got error...
0
by: Sinchana | last post by:
Hi All, In our .Net 2.0 Application ,we have a third party Tree Control. We are loading the Tree control nodes using a stored procedure and the tree nodes are populating perfectly.But some time...
1
by: =?Utf-8?B?SmVycnkgSg==?= | last post by:
In my ASP.net application I am getting the following error... "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occured because all pooled...
1
by: bimowidhi | last post by:
Hi, I'm a newbie here, and also in PHP. Sorry for my bad English. I've walked around to find the answer of my problem, but I still can't get it. I develop PHP 5.2.5 Application, using SQL...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.