Timeout expired error while using select

Discussion in 'ASP General' started by Dax, Jul 20, 2006.

  1. Dax

    Dax Guest

    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?
    Dax, Jul 20, 2006
    #1
    1. Advertising

  2. Dax wrote:
    > 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
    >

    <snip>
    > 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

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jul 20, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page