Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Problems paging a recordset


Message #1 by "Claudio M. E. Bastos Iorio" <mcclau@p...> on Sun, 18 Aug 2002 09:42:41 -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
  _____ 


Message #2 by "Ken Schaefer" <ken@a...> on Mon, 19 Aug 2002 16:24:43 +1000
Do you have <%Option Explicit%> in your code? (it's supposed to be at the
top of the page)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Claudio M. E. Bastos Iorio" <mcclau@p...>
Subject: [access_asp] Problems paging a recordset


Excuse me Guys, I don't know if this is OFF TOPIC in this list. I have a
problem paging a recordset. I don't speak english very well, so ill try
to explain my self the best I can. My code look like this:

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

  Set ObConn = Server.CreateObject("ADODB.Connection")
  Set ObCommand = Server.CreateObject("ADODB.Command")
  Set ObRS = Server.CreateObject("ADODB.RecordSet")
  ObConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Server.Mappath("db.mdb")
  ObCommand.ActiveConnection = ObConn
  ObCommand.CommandType = adCmdText
  Sql = "SELECT * FROM Somewhere"
  ObCommand.CommandText = Sql
  'Set ObRs = ObCommand.Execute()
  ObRS.Open ObCommand, , adOpenStatic

'starts paging
ObRS.Pagesize = 25
ObRS.AbsolutePage=Session("pagina") %>
                   <% Registro = 0
DO While Registro < 25 AND NOT ObRS.Eof %>

                      <% = ObRs("Articulo") %>
                         <% = ObRs("Moneda") %>
                        <% = ObRs("Precio") %>
                       <% = ObRs("Descripcion") %>
                       <%  Registro = Registro + 1
ObRs.MoveNext
   LOOP  %>
            <form name="form1" method="get" action="">
              <% If Session("pagina") > 1 THEN %>
              <input type="submit" name="pagina" value="PaginaAnterior"
class="formbutton"> <!-- button back -->
              <% END IF
IF Session("pagina") < ObRS.PageCount  THEN %>
              <input type="submit" name="pagina" value="PaginaSiguiente"
class="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 -=Excelence in IT Solutions=-
-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
„¤„clau§ka„¤„® „¤„§electer§„¤„®
ICQ#: 24094716
  _____




Message #3 by =?iso-8859-1?q?shyam=20sedamkar?= <shysed@y...> on Wed, 21 Aug 2002 13:05:17 +0100 (BST)
<P> 
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i&nbsp;&nbsp;
need u r help regarding :&nbsp;&nbsp; advantages of
SQL-server-2000
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; very urgently 
<P>&nbsp;
<P>&nbsp;
<P>&nbsp;
<P>&nbsp; <B><I>Ken Schaefer
&lt;ken@a...&gt;</I></B> wrote: 
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT:
5px; BORDER-LEFT: #1010ff 2px solid">Do you have
<%Option Explicit%>in your code? (it's supposed to be
at the<BR>top of the
page)<BR><BR>Cheers<BR>Ken<BR><BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>From:
"Claudio M. E. Bastos Iorio"
<MCCLAU@P...><BR>Subject: [access_asp]
Problems paging a recordset<BR><BR><BR>Excuse me Guys,
I don't know if this is OFF TOPIC in this list. I have
a<BR>problem paging a recordset. I don't speak english
very well, so ill try<BR>to explain my self the best I
can. My code look like this:<BR><BR><!-- #INCLUDE File
= "ADOVBS.inc" --><BR><%<br>  'request 4 buttons
forward and back<br>   IF
(Request.QueryString("pagina") =<br>"PaginaSiguiente")
THEN 'this is next page<br>Session("pagina")  
Session("pagina") + 1<br>ELSE IF
(Request.QueryString("pagina") = "PaginaAnterior")
THEN ' this<br>is back to page<br>Session("pagina") 
Session("pagina") - 1<br>ELSE Session("pagina") 
1<br>END IF<br>END IF<br><br>  Set ObConn 
Server.CreateObject("ADODB.Connection")<br>  Set
ObCommand = Server.CreateObject("ADODB.Command")<br> 
Set ObRS = Server.CreateObject("ADODB.RecordSet")<br> 
ObConn.Open
"Provider=Microsoft.Jet.OLEDB.4.0;Data<br>Source=" &
Server.Mappath("db.mdb")<br> 
ObCommand.ActiveConnection = ObConn<br> 
ObCommand.CommandType = adCmdText<br>  Sql = "SELECT *
FROM Somewhere"<br>  ObCommand.CommandText = Sql<br> 
'Set ObRs = ObCommand.Execute()<br>  ObRS.Open
ObCommand, , adOpenStatic<br><br>'starts
paging<br>ObRS.Pagesize 
25<br>ObRS.AbsolutePage=Session("pagina") %><BR><%
Registro = 0<br>DO While Registro < 25 AND NOT
ObRS.Eof %><BR><BR><% = ObRs("Articulo") %><BR><% 
ObRs("Moneda") %><BR><% = ObRs("Precio") %><BR><% 
ObRs("Descripcion") %><BR><%  Registro = Registro +
1<br>ObRs.MoveNext<br>   LOOP  %><BR>
<FORM name=form1 action="" method=get><BR><% If
Session("pagina") > 1 THEN %><BR><INPUT type=submit
value=PaginaAnterior name=pagina
<br>class="formbutton"&gt; <!-- button back --><BR><%
END IF<br>IF Session("pagina") < ObRS.PageCount  THEN
%><BR><INPUT type=submit value=PaginaSiguiente
name=pagina <br>class="formbutton"&gt; <!-- button
next --><BR><% END IF %><BR></FORM><BR><%
ObRS.Close<br>  ObConn.Close<br>   %><BR><BR><BR>OK.
This code work fine in my development server, I see
the RS paged,<BR>with the button next and back working
fine. BUT in my production server<BR>it doesn't work,
I allways see the first page, cannot see the next
page,<BR>clicking in the next button. I tried
permissions, etc, but I allways get<BR>the same error.
Anyone can point me to a solution? Ill apreciate
that.<BR>TIA<BR><BR>Some hints: the only difference
within my production and development<BR>server is that
I have a couple of sites working on production server
in<BR>IIS5, with host header. Could be this the
problem? THANK U<BR>_____<BR><BR>Claudio M. E. Bastos
Iorio<BR>Blumer -=Excelence in IT Solutions=-<BR>-Web
Development<BR>-Web Design<BR>-Web Solutions<BR>To
Contact point your browser to
http://www.blumer.com.ar<BR>MSN:
clauska@h...<BR>Yahoo! Messenger:
selecters75@y...<BR>Phone: 54 11
1551467975<BR>Adress: Av Chiclana 3735 Of: C (1262) -
Cap Fed<BR>2002 Buenos Aires - Rep.
Argentina<BR>„¤„clau§ka„¤„® „¤„§electer§„¤„®<BR>ICQ#:
24094716<BR>_____<BR><BR><BR><BR>---<BR>Change your
mail options at http://p2p.wrox.com/manager.asp
or<BR>
<BR><BR><BR>---<BR>Change your mail
options at http://p2p.wrox.com/manager.asp or <BR>to
unsubscribe send a blank email to </BLOCKQUOTE>

________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
       visit http://in.autos.yahoo.com

  Return to Index