Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query causes sql to hang

Author  Topic 

Kappy
Starting Member

30 Posts

Posted - 2002-04-05 : 11:28:59
Hi-

I am trying to execute the following query in an ASP page. Every time it runs, it pegs out the processor on the database server and eventually just times out. When I run the query in query analyzer, it works fine. Any idea? Similar querys (using the same sort of objects) work fine.

set objList = Server.CreateObject ("ADODB.Recordset")
strList = "select ID as jobid , Job, Notes from jobs where [Customers_ID] = "& (Custid) & ""
objList.Open strList ,"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=**;Initial Catalog=DBNAME;Data Source=DBSERVER"

Thanks!

Jay99

468 Posts

Posted - 2002-04-05 : 11:31:11
There must be more to the story. Run profiler and see what's going on differently . . .

Jay
<O>
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-04-05 : 11:32:04
I assume by "just fine" you mean it executes in less time than the ADO connection timeout you have specified?

Provide more details ...

setBasedIsTheTruepath
<O>
Go to Top of Page

Kappy
Starting Member

30 Posts

Posted - 2002-04-05 : 13:03:05
I have run profiler, logging just about everything that I can, but it doesn't tell me much - I don't get any errors. Admittedly, I am not that familiar with profiler, so I could be missing something. All it's really telling me is that objects are opening and closing.

The other queries do execute well within the connection timeout.

The entire page consists of about 5 recordsets, and I have tried commenting out various ones, but it comes down to just the one that I mentioned above that is having the problem. The only other info that I can find, but don't know if it's related to the problem, is that the dllhost.exe process is what is hogging the cpu.

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-04-05 : 13:15:47
DLLHost is usually either an IIS virtual directory set to "high isolation" or a COM+ / MTS package possibly.

If the query runs fine in QA, maybe it's what you are doing after you get the recordset that is causing timeouts? What error in the ASP page that you get? Is it an ASP timeout or a SQL timeout?

Can you post the code to your ASP page?
What Version of SQL, IIS, and Windows are you running on your server?

Michael

Go to Top of Page

Kappy
Starting Member

30 Posts

Posted - 2002-04-05 : 15:17:14
Michael-

Here is the code...
I am running SQL Server 7 on NT Server, IIS 4.

set oRs = Server.CreateObject ("ADODB.Recordset")
SQLGet = "select class as Category, type as Kind, grade as Grade, numinstock AS Amount from dbo.inventory"
oRs.Open SQLGet,"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=DBNAME;Data Source=DBSERVER"


do while not oRs.BOF or oRs.EOF
Response.Write oRs("Class")
Response.Write " "
Response.Write oRs("type")
Response.Write " "
Response.Write oRs("Grade")
Response.Write " "
Response.Write oRs("numinstock")
Response.Write " "
Loop

oRs.Close
set oRs = nothing

I had originally had the database running on Windows 2000 advanced server - and encountered the same problems. I'm guessing its the code...


Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-04-05 : 15:29:29
you have an infinite loop

make sure you have oRS.MoveNext otherwise you will never get to your next record in your recordset.


Like so

while not oRs.EOF
oRs.MoveNext
wend



Go to Top of Page

Kappy
Starting Member

30 Posts

Posted - 2002-04-05 : 15:47:59
Aha! Thank you so much!

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-04-05 : 18:04:51
I knew it had to be in the ASP....

Two "move next" issues today. wow

Michael

Go to Top of Page
   

- Advertisement -