| |
RUBRICA / INDIRIZZARIO
<%
dim maxPages, maxRecs, strPageSize
strPageSize = 15
dim tipoana 'contiene nome campo del db che deve essere true (esempio W_AITEC W_LAPO, W_FISEVDA, W_CIGIR)
tipoana = trim(Request.QueryString("tipo"))
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConn
mypage = request("P")
if mypage = "" then
mypage = 1
end if
if trim(tipoana) <> "" then
strSql = "SELECT * FROM Rubrica WHERE " & tipoana & " = true ORDER BY "
else
strSql = "SELECT * FROM Rubrica ORDER BY "
end if
select case Request.QueryString("S")
case "persona_asc" strSql = strSql & "persona, Azienda "
case "persona_desc" strSql = strSql & "Persona DESC, Azienda DESC"
case "azienda_asc" strSql = strSql & "Azienda, Azienda"
case "azienda_desc" strSql = strSql & "Azienda DESC, Persona DESC"
case "prov_asc" strSql = strSql & "Prov,Persona,Azienda "
case "prov_desc" strSql = strSql & "Prov DESC,Persona,Azienda "
case "citta_asc" strSql = strSql & "Citta,Persona,Azienda "
case "citta_desc" strSql = strSql & "Citta DESC,Persona,Azienda "
case "cap_asc" strSql = strSql & "CAP,Persona,Azienda "
case "cap_desc" strSql = strSql & "CAP DESC,Persona,Azienda "
case else strSql = strSql & "Persona,Azienda "
end select
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.cachesize=20
rs.open strSql, my_conn, 3
if not (rs.EOF or rs.BOF) then
rs.movefirst
rs.pagesize = strPageSize
rs.cacheSize = strPageSize
maxPages = cint(rs.pageCount)
maxRecs = cint(rs.pageSize)
rs.absolutePage = myPage
maxpages = cint(rs.pagecount)
end if
if maxpages > 1 then
Call Paging()
end if
%>
IDn |
">
Persona
">
Org / Azienda |
Indirizzo
">
Cap
">
Città
">
Prov |
<% if rs.EOF or rs.BOF then %>
Non ci sono records |
<% else
howManyRecs = 0
rec = 1
do until rs.Eof or rec = (strPageSize + 1)
%>
"> <% =rs("IDN") %>
|
<% if rs("Persona") <> "" then %>
<% =rs("Persona") %>
<% end if %>
<% =rs("Azienda") %>
<% if rs("email") <> "" then %>
"><% =rs("email") %>
<% end if %>
|
<% =rs("indirizzo") %> <% =rs("Cap") %> <% =rs("Citta") %> <% =rs("Prov") %>
<% if rs("web") <> "" then %>
"><% =rs("web") %>
<% end if %>
|
<%
rs.MoveNext
rec = rec + 1
loop
%>
<%
if maxpages > 1 then
Call Paging()
end if
end if
my_Conn.Close
set my_Conn = nothing
function widenum(fNum)
if fNum > 9 then
widenum = ""
else
widenum = " "
end if
end function
sub Paging()
%>
<%
if maxpages > 1 then
if Request.QueryString("P") = "" then
sPageNumber = 1
else
sPageNumber = Request.QueryString("P")
end if
if Request.QueryString("S") = "" then
sS = "persona_asc"
else
sS = Request.QueryString("S")
end if
sScriptName = Request.ServerVariables("script_name")
for counter = 1 to maxpages
if counter <> cint(sPageNumber) then
sNum = " "& widenum(counter) & "" & counter & ""
Response.Write sNum & vbCrLf
else
Response.Write(" " & widenum(counter) & "" & counter & "")
end if
next
end if
%>
<%
end sub
%>
Ricerca nella banca dati
|