Guida imballaggio Packaging Web Directory
<%
'RECUPERO VALORI
Dim categoria, cat, scat1, scat2, sotto, contaRec, objRS, view
'PARAMETRI DI PAGINAZIONE
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim iRecordsShown
Dim I
'**************************************************************
'RICERCA PER CATEGORIE
'**************************************************************
'CATEGORIA
cat=Replace(Request("cat"),"'","''")
if cat<>"" then
strCat=split(Replace(cat,"''","'"),"/")
end if
'SOTTOCATEGORIA 1
scat1=Replace(Request.QueryString("scat1"),"'","''")
if scat1<>"" then
strScat1=split(Replace(scat1,"''","'"),"/")
end if
'SOTTOCATEGORIA 2
scat2=Replace(Request.QueryString("scat2"),"'","''")
if scat2<>"" then
strScat2=split(Replace(scat2,"''","'"),"/")
end if
sotto=Request.QueryString("sotto")
%>
<%if cat="" then%>
Chieda nuovi preventivi
gratuiti ai 2000 fornitori
inclusi nelle 9
Categorie del
portale
Selezioni una
regione o un
fornitore in
evidenza
<%end if%>
<%if cat="" then%>
<%
ELSE 'NEGLI ALTRI CASI
iPageSize = 5 'NUMERO RECORD PER PAGINA
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
If Request.QueryString("order") = "" Then
strOrderBy = "priorita, ragsoc"
Else
strOrderBy = Request.QueryString("order")
End If
'****************************************************
' SOTTOCATEGORIA 1
'****************************************************
IF sotto="uno" THEN
'CONTROLLO SE LA SOTTOCATEGORIA 1 ESISTE
strSQL="SELECT DISTINCT scat1 FROM tImb WHERE cat='"& cat &"' "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
contaRec=0
Do while not objRS.EOF
if objRS("scat1")<>"" then
contaRec=contaRec+1
End if
objRS.MoveNext
Loop
objRS.Close
set objRS = nothing
Set objRS = Server.CreateObject("ADODB.Recordset")
if contaRec>0 then
'LA SOTTOCATEGORIA 1 ESISTE
strSQL="SELECT DISTINCT cat, scat1 FROM tImb WHERE cat='"& cat &"' ORDER BY scat1"
objRS.Open strSQL, objConn
contaRec=0
contaFound=0
Do While Not objRS.EOF
if objRS("scat1")<>"" then
contaRec=contaRec+1
If contaFound=0 then%>
<%
Else
'LA SOTTOCATEGORIA 1 NON ESISTE
contaFound=0
strSQL="SELECT * FROM tImb WHERE cat='"& cat &"' ORDER BY priorita, ragsoc"
objRS.PageSize = iPageSize
objRS.CacheSize = iPageSize
objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
reccount = objRS.recordcount
iPageCount = objRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "
Non è stato trovato nessun record. No record found.
"
Else
objRS.AbsolutePage = iPageCurrent
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objRS.EOF
'ESISTE SOLO LA CATEGORIA
if contaFound=0 then%>
<%=strCat(0)%> <%=strCat(1)%>
<%contaFound=contaFound+1
end if%>
<%
iRecordsShown = iRecordsShown + 1
objRS.movenext
view="fornitore"
Loop
End If
objRS.Close
set objRS = nothing
%>
<%
end if
end if
END IF
'FINE SOTTOCATEGORIA 1
'****************************************************
' SOTTOCATEGORIA 2
'****************************************************
IF sotto="due" THEN
'CONTROLLO SE LA SOTTOCATEGORIA 2 ESISTE
strSQL="SELECT DISTINCT scat2 FROM tImb WHERE cat='"& cat &"' AND scat1='"&scat1&"' "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
contaRec=0
contaFound=0
Do while not objRS.EOF
if objRS("scat2")<>"" then
contaRec=contaRec+1
End if
objRS.MoveNext
Loop
objRS.Close
set objRS = nothing
Set objRS = Server.CreateObject("ADODB.Recordset")
if contaRec>0 then
'LA SOTTOCATEGORIA 2 ESISTE
strSQL="SELECT DISTINCT scat2 FROM tImb WHERE cat='"& cat &"' AND scat1='"& scat1 &"' ORDER BY scat2"
objRS.Open strSQL, objConn
contaRec=0
contaFound=0
Do While Not objRS.EOF
if objRS("scat2")<>"" then
contaRec=contaRec+1
If contafound=0 then%>
<%
end if
End if
END IF
'FINE SOTTOCATEGORIA 2
'PRESENTO L'ELENCO DELLE AZIENDE CHE SODDISFANO ENTRAMBE LE SOTTOCATEGORIE
IF sotto="tutti" then
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL="SELECT * FROM tImb WHERE cat='"& cat &"' AND scat1='"& scat1 &"' AND scat2='"& scat2 &"' ORDER BY priorita, ragsoc"
objRS.PageSize = iPageSize
objRS.CacheSize = iPageSize
objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
reccount = objRS.recordcount
iPageCount = objRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "
Non è stato trovato nessun record. No record found.
"
Else
objRS.AbsolutePage = iPageCurrent
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objRS.EOF
if contaFound=0 then%>
<%
end if
End if
END IF
'FINE CATEGORIA, SOTTOCATEGRIA 1 E SOTTTOCATEGORIA 2
' ************* FINE **************
objConn.Close
set objConn = nothing
%>
RICERCA
ALFABETICA AZIENDE
<%for i=65 to 90%>
<%=chr(i)%>
<%next%>