Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Problem paging a recordset


Message #1 by "Claudio M. E. Bastos Iorio" <mcclau@p...> on Sun, 18 Aug 2002 09:41:45 -0300
Excuse me Guys, I don=92t know if this is OFF TOPIC in this list.
I have a problem paging a recordset. I don=92t speak english very well, 
so
ill try to explain my self the best I can.
My code look like this:

 <!-- #INCLUDE File =3D "ADOVBS.inc" -->
            <%
		  'request 4 buttons forward and back
		   IF (Request.QueryString("pagina") =3D
"PaginaSiguiente") THEN 'this is next page
Session("pagina")  =3D Session("pagina") + 1
ELSE IF (Request.QueryString("pagina") =3D "PaginaAnterior") THEN ' this
is back to page
Session("pagina") =3D Session("pagina") - 1
ELSE Session("pagina") =3D 1
END IF
END IF

		  Set ObConn =3D Server.CreateObject("ADODB.Connection")
		  Set ObCommand =3D Server.CreateObject("ADODB.Command")
		  Set ObRS =3D Server.CreateObject("ADODB.RecordSet")
		  ObConn.Open "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
Source=3D" & Server.Mappath("db.mdb")
		  ObCommand.ActiveConnection =3D ObConn
		  ObCommand.CommandType =3D adCmdText
		  Sql =3D "SELECT * FROM Somewhere"
		  ObCommand.CommandText =3D Sql
		  'Set ObRs =3D ObCommand.Execute()
		  ObRS.Open ObCommand, , adOpenStatic
		
'starts paging
ObRS.Pagesize =3D 25
ObRS.AbsolutePage=3DSession("pagina") %>
                   <% Registro =3D 0
			DO While Registro < 25 AND NOT ObRS.Eof %>
           
                      <% =3D ObRs("Articulo") %>
                         <% =3D ObRs("Moneda") %>
                        <% =3D ObRs("Precio") %>
                       <% =3D ObRs("Descripcion") %>
                       <%  Registro =3D Registro + 1
			ObRs.MoveNext
		   LOOP  %>
            <form name=3D"form1" method=3D"get" action=3D"">
              <% If Session("pagina") > 1 THEN %>
              <input type=3D"submit" name=3D"pagina" 
value=3D"PaginaAnterior"
class=3D"formbutton"> <!-- button back -->
              <% END IF
IF Session("pagina") < ObRS.PageCount  THEN %>
              <input type=3D"submit" name=3D"pagina" 
value=3D"PaginaSiguiente"
class=3D"formbutton"> <!-- button next -->
              <% END IF %>
            </form>
            <% ObRS.Close
		  ObConn.Close
		   %>
          

OK. This code work fine in my development server, I see the RS paged,
with the button next and back working fine. BUT in my production server
it doesn't work, I allways see the first page, cannot see the next page,
clicking in the next button. I tried permissions, etc, but I allways get
the same error. Anyone can point me to a solution? Ill apreciate that.
TIA

Some hints: the only difference within my production and development
server is that I have a couple of sites working on production server in
IIS5, with host header. Could be this the problem? THANK U
  _____ 

Claudio M. E. Bastos Iorio
Blumer -=3DExcelence in IT Solutions=3D-
-Web Development
-Web Design
-Web Solutions
To Contact point your browser to http://www.blumer.com.ar
MSN: clauska@h...
Yahoo! Messenger: selecters75@y...
Phone: 54 11 1551467975
Adress: Av Chiclana 3735 Of: C (1262) - Cap Fed
2002 Buenos Aires - Rep. Argentina
=A5=A4=A5clau=A7ka=A5=A4=A5=AE =A5=A4=A5=A7electer=A7=A5=A4=A5=AE
ICQ#: 24094716
  _____ 





  Return to Index