Timeout expired error while using select


D

Dax

Hi,
I have a problema of query in an asp page, if I run the query in sql
query analizer is time running it's about 3-4 seconds, if I made the
same query in an asp page it create the error of timeout for the
browser. The result of the query output 2000 of records, all in one
page.

The query is the following:

Legend:
A table ordini_user refer to user
U table utenti refer ti prodoct requested
q table refer to product available


select distinct p.cognome, a.ord_ID, q.prod_id, q.descrip, u.qta
from ordini_user A
join ordini_utenti U on A.ord_id = U.ord_id and u.ord_id like
'62006___'
join utenti p on A.id_user = p.codcliente
and p.cognome like '%Marco%'
join prodotto q on U.prod_id=q.prod_id
order by p.cognome, q.prod_ID

the asp code is the following

Set conn1 = Server.CreateObject("ADODB.Connection")
conn1.open "PROVIDER=SQLOLEDB;DATA
SOURCE=test_sql;UID=test;PWD=blank;DATABASE=Test"
set rs1=Server.CreateObject("ADODB.Recordset")

sql1="select distinct p.cognome, a.ord_ID, q.prod_id, q.descrip, u.qta
" &_
"from ordini_user A "&_
"join ordini_utenti U on A.ord_id = U.ord_id "&_
"and a.ord_id like '"&cod_ordine&"%' "&_
"join utenti p on A.id_user = p.codcliente "&_
"and p.cognome like '%"&fname&"%' join prodotto q on
U.prod_id=q.prod_id "&_
"order by p.cognome, q.prod_ID"

response.write(sql1)

rs1.Open sql1, conn1

do while not rs1.EOF
strtable = strtable & "<tr>" &_
"<td><input type='hidden' name='Cod' value=" & rs1(0)
& "></td>" &_
"<td bgcolor='#D0F1FF'><div align='center'><font
color='#000000'>" & rs1(0) & "</font></div></td>" &_
"<td bgcolor='#D0F1FF'><div align='center'><font
color='#000000'>" & rs1(1) & "</font></div></td>" &_
"<td bgcolor='#D0F1FF'><div align='center'><font
color='#000000'>" & rs1(2) & "</font></div></td>" &_
"<td bgcolor='#D0F1FF'><div align='center'><font
color='#000000'>" & rs1(3) & "</font></div></td>" &_
"<td bgcolor='#D0F1FF'><div align='center'><font
color='#000000'>" & rs1(4) & "</font></div></td>" &_
"</font></tr>"

Ho can I optimize or modify the output source consider that I want to
print all these records?
 
Ad

Advertisements

B

Bob Barrows [MVP]

Dax said:
Hi,
I have a problema of query in an asp page, if I run the query in sql
query analizer is time running it's about 3-4 seconds, if I made the
same query in an asp page it create the error of timeout for the

What kind of timeout? Script timeout or ADO Command timeout?

It never hurts to copy and paste the entire error message you are receiving,
as well as showing us which line of code is being referred to in the error
message.

browser. The result of the query output 2000 of records, all in one
page.

The query is the following:

Legend:
A table ordini_user refer to user
U table utenti refer ti prodoct requested
q table refer to product available
do while not rs1.EOF
<snip>

I don't see an rs1.MoveNext statement. Are you sure you haven't created an
infinite loop?

http://www.aspfaq.com/show.asp?id=2366
http://www.aspfaq.com/show.asp?id=2066
http://www.aspfaq.com/show.asp?id=2424
http://www.aspfaq.com/show.asp?id=2120
http://www.aspfaq.com/show.asp?id=2467
 

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