%@ Language=VBScript %> <% Option Explicit %> <% Response.Buffer = True %> <% dim iNbrTo,nbrToDisplay,iNbrFrom,lastpage,modul ,colonne,liensOrganisme '************************************ Const adUseClient = 3 Const adOpenStatic = 3 Dim Connect_String Dim Page_Size Dim Current_Page Dim MyConn Dim RS,rsQuery Dim sSQL, strSql, sSQLOrg Dim Page_Count '****************** Page_Size = 10 'here we set the number of records viewed per page to 15. If Request("iPage")="1" Then Current_Page = 1 Else Current_Page = CInt(Request("iPage")) End If Set RS = Server.CreateObject("ADODB.RecordSet") RS.CursorLocation = adUseClient RS.PageSize = Page_Size '************************************************** if Request("codeO") <> "" then sSQLOrg = sSQLOrg & "Organisations.CodeO = " & RemoveJunk(Request("codeO")) & " and " liensOrganisme = liensOrganisme&"code="& Request("codeO") &"&" end if if Request("Nom") <> "" then sSQLOrg = sSQLOrg & "Organisations.Nom Like '" & RemoveJunk(Request("Nom")) & "%' and " liensOrganisme = liensOrganisme&"Nom="& Request("Nom") &"&" end if if Request("Statut") <> "" then sSQLOrg = sSQLOrg & "Organisations.Statut = " & Request("Statut") & " and " liensOrganisme = liensOrganisme&"Statut="& Request("Statut") &"&" end if if Request("adresse") <> "" then sSQLOrg = sSQLOrg & "Organisations.Adresse = '" & RemoveJunk(Request("adresse")) & "' and " liensOrganisme = liensOrganisme&"adresse="& Request("adresse") &"&" end if if Request("Tel") <> "" then sSQLOrg = sSQLOrg & "Organisations.Tel = '" & RemoveJunk(Request("Tel")) & "' and " liensOrganisme = liensOrganisme&"Tel="& Request("Tel") &"&" end if if Request("Fax") <> "" then sSQLOrg = sSQLOrg & "Organisations.Fax = '" & RemoveJunk(Request("Fax")) & "' and " liensOrganisme = liensOrganisme&"Fax="& Request("Fax") &"&" end if if Request("NomResponsable") <> "" then sSQLOrg = sSQLOrg & "Organisations.NomResponsable = '" & RemoveJunk(Request("NomResponsable")) & "' and " liensOrganisme = liensOrganisme&"NomResponsable="& Request("NomResponsable") &"&" end if if Request("PrenomResponsable") <> "" then sSQLOrg = sSQLOrg & "Organisations.PrenomResponsable = '" & RemoveJunk(Request("PrenomResponsable")) & "' and " liensOrganisme = liensOrganisme&"PrenomResponsable="& Request("PrenomResponsable") &"&" end if if Request("TelResponsable") <> "" then sSQLOrg = sSQLOrg & "Organisations.TelResponsable = '" & RemoveJunk(Request("TelResponsable")) & "' and " liensOrganisme = liensOrganisme&"TelResponsable="& Request("TelResponsable") &"&" end if if sSQLOrg = "" then Response.Redirect ("RechercheOrganisme.asp") end if strSql = "SELECT count(*) as iNbrNodes FROM Organisations WHERE "& Left(sSQLOrg, Len(sSQLOrg) - 4)&" " Set rsQuery = Conn.Execute(strSql) nbrToDisplay = rsQuery("iNbrNodes") sSQL = "SELECT * FROM Organisations WHERE "& Left(sSQLOrg, Len(sSQLOrg) - 4)&" order by Nom" '********************************** if nbrToDisplay <> "0" then RS.Open sSQL, Conn, adOpenStatic Page_Count = RS.PageCount If 1 > Current_Page Then Current_Page = 1 If Current_Page > Page_Count Then Current_Page = Page_Count RS.AbsolutePage = Current_Page end if 'iNbrFrom If Current_Page ="1" Then iNbrFrom = 1 iNbrTo = Page_Size Else iNbrFrom = Page_Size * (Current_Page - 1) iNbrTo = iNbrFrom + Page_Size End If modul = nbrToDisplay MOD Page_Size if modul <> "0" then lastpage = Cint(nbrToDisplay/Page_Size) + 1 else lastpage = Cint(nbrToDisplay/Page_Size) end if '************************************************** Response.Cookies("Current_PageOrganisme") = Current_Page Response.Cookies("liensOrganisme") = liensOrganisme %>
|