eccolo..

arriva a scrivere UNO e poi da errore...UNO è una prova per trovare il punto esato dove sballa...






<center><b class='titolo'><%=ricerca_ris(0)%>[/b]</center>




<b class='testo_rosso'>Ordina per: <a href='ricerca_risultato.asp'
<%
dim tipo, contratto, regione, cb_affitto, cb_vendita, citta, vani, zona, mq, prezzo, prezzo_min, prezzo_max, strsql, lingua, tipo_orig, contratto_orig, app_zona, ordinamento

tipo=request("tipo")
contratto=request("contratto")
regione=request("regione")
citta=request("citta")
zona=request("zona")
mq_min=request("mq_min")
mq_max=request("mq_max")
prezzo_min=request("prezzo_min")
prezzo_max=request("prezzo_max")
vani=request("vani")
app_zona=request("app_zona")
%>




VANI -
PREZZO



<%
' Imposto ordinamento che di default è prezzo
ordinamento= "prezzo"
' controllo se pag caricata da ricerca o da refresh con ordinamento
pag = request("pag")

if (pag = "R") then
ordinamento = request("ordinamento")
ordinamento = ordinamento
response.write pag & "--" & ordinamento
end if


dim stampa
' PREPARO URL PER PAGINA PRINT CHE STAMPA
stampa = "ricerca_stampa.asp?tipo="&tipo&"&contratto="& contratto & "&regione="& regione & "&citta="&citta& "&zona="& zona & "&mq="& mq & "&prezzo="& prezzo & "&vani="& vani

strsql= "SELECT * FROM immobili WHERE 1 = 1 "

if (tipo <> "--") then

'faccio la query estraendo il tipo di immobile tradotto ovvero traduzione passando il tipo in ita che arriva dalla form ovvero tipo ricavato sopra -> il tutto nella lingua attuale (Lang in sessione che ho già)
strsql_tipo_trad = "SELECT traduzione from ana_tipo_trad WHERE nome ='" & tipo & "' AND lingua='" & lang & "'"

set DBrec=server.createobject("ADODB.recordset")
DBrec.open strsql_tipo_trad, Conn, 3, 3

'Inserisco in una variabile il valore di tipo tradotto
tipo_tradotto = DBrec("traduzione")

strsql = strsql & " AND tipo= '"& tipo &"' "

'Chiudo l’oggetto Recordset
DBrec.Close
Set DBrec = Nothing
end if


if (tipo = "--") then
tipo_tradotto = tipo
end if

if (contratto <> "--") then

'faccio la query estraendo il tipo di immobile tradotto ovvero traduzione passando il tipo in ita che arriva dalla form ovvero tipo ricavato sopra -> il tutto nella lingua attuale (Lang in sessione che ho già)
strsql_contratto_trad = "SELECT traduzione from ana_contratto_trad WHERE nome ='" & contratto & "' AND lingua='" & lang & "'"

set DBrec=server.createobject("ADODB.recordset")
DBrec.open strsql_contratto_trad, Conn, 3, 3

'Inserisco in una variabile il valore di tipo tradotto
contratto_tradotto = DBrec("traduzione")

strsql = strsql & " AND contratto='" & contratto & "'"

'Chiudo l’oggetto Recordset
DBrec.Close
Set DBrec = Nothing
end if


if (contratto = "--") then
contratto_tradotto = contratto
end if


if regione <> "--" then
strsql = strsql & " AND app_regione='" & regione & "'"
end if

if citta <> "--" then
strsql = strsql & " AND app_citta='" & citta & "'"
end if

if zona <> "--" then
strsql = strsql & " AND app_zona='" & zona & "'"
end if

if vani <> "--" then
strsql = strsql & " AND vani='" & vani & "'"
end if

if (mq_min <> "") AND (mq_max <> "") then
strsql = strsql & " AND mq BETWEEN " & "'"&mq_min&"' AND '"&mq_max&"'"
end if

if (prezzo_min <> "") AND (prezzo_max <> "") then
prezzo_max = prezzo_max + 1
strsql = strsql & " AND prezzo BETWEEN " & "'"&prezzo_min&"' AND '"&prezzo_max&"'"
end if

' Creo la stringa inserendo ordinamento
strsql= strsql & " ORDER BY " & ordinamento

response.write "UNO - da qui sballa e da l' errore"

set DBrec=server.createobject("ADODB.recordset")
DBrec.open strsql, Conn, 3, 3


'Test per vedere se trova record
if(DBrec.recordcount) <> 0 then
'Stampo i record dentro singole tabelle

%>
<b class='titolo'><%=ricerca_ris(15)%>:[/b]<b class='testo_rosso_bold'> <%=DBrec.recordcount%>[/b]

<%
do while not DBrec.EOF
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0" height="88">
<tr>
<td width="50%" valign="top" height="5" bgcolor='#1661a0'><b class='testo_bianco_bold'><%=ricerca_ris(1)%>:[/b] <b class='testo_bianco_bold'> <%=tipo_tradotto%>[/b]</td>
<td width="40%" valign="top" height="5" bgcolor='#1661a0'><b class='testo_bianco_bold'><%=ricerca_ris(2)%>:[/b] <b class='testo_bianco_bold'> <%=contratto_tradotto%>[/b]</td>
<td width="40%" valign="top" height="5" bgcolor='#1661a0'><b class='testo_bianco_bold'><%=ricerca_ris(6)%>:[/b] <b class='testo_bianco_bold'> <%=DBrec("vani")%>[/b]</td>
</tr>
<tr>
<td colspan='3' width="50%" valign="top" height="43" bgcolor='#f7f8f9'><b class='testo_rosso_bold'>Descrizone:[/b] <b class='testo'> <%=DBrec("descrizione")%>[/b]</td>
</tr>
<tr>
<td width="50%" valign="top" height="5" bgcolor='#E4E4E4'><b class='testo_bold'><%=ricerca_ris(5)%>:[/b] <b class='testo_bold'> <%=DBrec("app_zona")%>[/b]</td>
<td width="40%" valign="top" height="5" bgcolor='#E4E4E4'><b class='testo_bold'><%=ricerca_ris(8)%>:[/b] <b class='testo_bold'> <%=DBrec("prezzo")%> &euro;[/b]</td>
<td width="40%" valign="top" height="5" bgcolor='#E4E4E4'><%=ricerca_ris(9)%>[img]layout/freccette.gif[/img][/b]</td>
</tr>
</table>


<%

DBrec.movenext
loop

'Chiudo l’oggetto Recordset
DBrec.Close
Set DBrec = Nothing


'SE NON TROVA NIENTE: MESSAGGIO DI ERRORE

else
response.redirect ("messaggio.asp?cod=55&ind=H")
response.end
end if

'FINE GESTIONE MESSAGGIO ERRORE
response.write "</table>"
response.write "
"

' COSTRUISCO LA STRINGA DA INVIARE VIA MAIL l' url della pagina a un amico
url="?"&Request.ServerVariables("URL")&"&tipo="&ti po&"&contratto="&contratto&"&regione="&regione&"&c itta="&citta&"&zona="&zona&"&mq="&mq&"&prezzo="&pr ezzo&"&vani="&vani
%>
<form id='stampa' name='segnala_amico' action='ricerca_segnala_amico.asp'>
<table align='left' width='40%' border='1' cellpadding='0' cellspacing='0'>
<tr>
<td>
<legend><b class='rosso'><%=ricerca_ris(10)%>[/b]</legend>

<input type='hidden' name='url' value='<%=Request.ServerVariables("HTTP_REFERER")% >'>
<table width='100%' align='left'>
<TR>
<TD><b class='testo'><%=ricerca_ris(11)%>:[/b]</TD><TD><input type='text' name='nome' size="10" MAXLENGTH='20'><input type='hidden' name='url' value='<%=url%>'></TD>
</TR>
<TR>
<TD><b class='testo'><%=ricerca_ris(12)%>:[/b]</TD><TD><input type='text' name='email' size="10" MAXLENGTH='30'></TD>
</TR>
<TR>
<TD colspan='2'><input type='image' src='layout/<%=ricerca_ris(13)%>_<%=lang%>.jpg'></TD><TD></TD>
</TR>
</table>
</td>
</table>
</form>
<input id='stampa' type='image' src='layout/stampa_<%=lang%>.gif' onclick="window.print()">

[img]layout/nuova_ricerca_<%=lang%>.gif[/img]'>




grazie