Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    varie conn e apertura/chiusura recordset

    ciao,

    scusate ma houn aserie di problemi con le conn che non riesco a risolvere: forse potete aiutarmi..

    ho la seguente pagina


    <%
    set DBrec = Server.CreateObject("ADODB.Recordset")
    %>
    <form class='form' name="ricerca" action="ricerca_risultato.asp" method='POST' bgcolor="red">
    <input type='hidden' name='ind' value='I'>
    <table width="35%" border='0' align='left' cellpadding='0' cellspacin='0'>
    <tr>
    <td><b class='testo'><%=ricerca(1)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_tipo_trad where lingua='" & lang & "' ORDER BY traduzione;"

    'Creo il recordset

    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>
    <select name="tipo">
    <option value='--'>--</option>
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("traduzione") &"</option>"
    DBrec.movenext
    loop
    %>
    </select>
    </td>
    <tr>
    <td><b class='testo'><%=ricerca(2)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_contratto_trad where lingua='" & lang & "' ORDER BY traduzione;"

    'Creo il recordset
    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>

    <select name="contratto">
    <option value='--'>--</option>
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("traduzione") &"</option>"
    DBrec.movenext
    loop


    set DBrec= nothing
    DBrec.close
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td><b class='testo'><%=ricerca(3)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_regione ORDER BY nome"

    'Creo il recordset
    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>
    <select name="regione">
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("nome") &"</option>"
    DBrec.movenext
    loop
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td><b class='testo'><%=ricerca(4)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_citta ORDER BY nome"

    'Creo il recordset
    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>
    <select name="citta">
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("nome") &"</option>"
    DBrec.movenext
    loop
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td><b class='testo'><%=ricerca(5)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_zona ORDER BY nome"

    'Creo il recordset
    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>
    <select name="zona">
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("nome") &"</option>"
    DBrec.movenext
    loop
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td><b class='testo'><%=ricerca(6)%>:[/b]</td>
    <td>
    <%
    'Creo la query che pesca dati in base alla lingua
    strsql= "SELECT * FROM ana_vani"

    'Creo il recordset
    DBrec.open strsql, Conn, 3

    'INIZIO STAMPA TABELLA MOSTRA RISULTATI
    %>
    <select name="vani">
    <%
    do while not DBrec.EOF
    response.write "<option value='" & DBrec("nome") & "'>" & DBrec("nome") &"</option>"
    DBrec.movenext
    loop
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td>
    <b class='testo'><%=ricerca(7)%> <b class='testo_rosso'><%=ricerca(8)%>[/b]:[/b]
    </td>
    <td>
    <input type='textbox' name='mq_min' size="5" MAXLENGTH='5'>
    </td>
    </tr>
    <td>
    <b class='testo'><%=ricerca(7)%><b class='testo_rosso'> <%=ricerca(9)%>[/b]:[/b]
    </td>
    <td>
    <input type='textbox' name='mq_max' size="5" MAXLENGTH='5'>
    </td>
    </tr>
    <tr>
    <td>
    <b class='testo'><%=ricerca(10)%> <b class='testo_rosso'> <%=ricerca(11)%>[/b]:[/b]
    </td>
    <td>
    <INPUT TYPE='TEXTBOX' name='prezzo_min' size="12" MAXLENGTH='12'>
    </td>
    </tr>
    <tr>
    <td>
    <b class='testo'><%=ricerca(10)%> <b class='testo_rosso'> <%=ricerca(12)%>[/b]:[/b]
    </td>
    <td>
    <INPUT TYPE='TEXTBOX' name='prezzo_max' size="12" MAXLENGTH='12'>
    </td>
    </tr>
    <tr>
    <td>


    <input type="image" src='layout/<%=ricerca(13)%>_<%=lang%>.jpg' alt='<%=ricerca(14)%>'>
    </td>
    </tr>
    </table>
    </form>
    <div class='clear'></div>
    [img]layout/soldi.gif[/img]<%=ricerca(15)%>

    <%
    'Chiudo tutto
    DBrec.close
    Set DBrec=nothing
    %>



    Questa form, esegue una serie di query, io apro la connessione in un file incluso, poi apro il recordset solo all' inizio della pagina con

    set DBrec = Server.CreateObject("ADODB.Recordset")

    ogni volta istanzio la nuova sql che eseguo con:

    DBrec.open strsql, Conn, 3

    e poi chiudo il tuto alla fin della pagina, ma ricevo il seguente errore dopo che ha stamapato il primo select:

    ADODB.Recordset error '800a0e79'

    Operation is not allowed when the object is open.

    /ricerca_form.txt, line 38

    solo riaprendo il recordset funziona.

    come mai?
    come posso fare?
    Se aro tutti i recordset poi come li chiuso?
    MI sono posto questo problema perchè ho il sito che appena lo apro è veloce e tutto va bene, dopo una serie di ricerche o navigazioni, si rallenta esageratamente senza motivo. Il server non è, anche perchè un altro sito sullo stesso dominio, in html va che è una scheggia...

    Penso siano le conn aperte...e non chiuse..sapete iutarmi?

    Grazie mille

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Sono irecordset aperti e non chiusi.
    Prima di aprire un nuovo recordset devi chiudere e distruggere il precedente.

    Roby

  3. #3
    si ok avevo intuito dopo un po di prove...grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.