Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - asp _scrolling the the data from the DB?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

asp _scrolling the the data from the DB?

 Post Reply Post Reply
Author
msm_eg View Drop Down
Newbie
Newbie
Avatar

Joined: 17 May 2003
Location: Egypt
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote msm_eg Quote  Post ReplyReply Direct Link To This Post Topic: asp _scrolling the the data from the DB?
    Posted: 03 October 2003 at 9:36am

how i can scroll the data that r coming from the db  and make it come in many pages like this   1|2|3|4|5

i know already how to make it scrool the data like Next>> and previose<<<

but i need to know how i can scroll it like No

Back to Top
yessir View Drop Down
Newbie
Newbie


Joined: 02 October 2003
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote yessir Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2003 at 11:22am

This is a combo of both...

It displays both numbers AND Next Prev, I hope this is what you are looking for!

' Display page numbers
If totalRecs > 0 Then
 rsEof = (totalRecs < (startRec + displayRecs))
 ' Find out if there should be Backward or Forward Buttons on the table.
 If  startRec = 1 Then
  isPrev = False
 Else
  isPrev = True
  PrevStart = startRec - displayRecs
  If PrevStart < 1 Then PrevStart = 1 %> 
 <a href="tbl_CTS_informationlist.asp?start=<%=PrevStart%> "><font face="Tahoma" size="1"><b>Prev</b></font></a>
 <%
 End If
 If (isPrev OR (NOT rsEof)) Then
  x = 1
  y = 1
  dx1 = ((startRec-1)\(displayRecs*recRange))*displayRecs*recRange+1
  dy1 = ((startRec-1)\(displayRecs*recRange))*recRange+1
  If (dx1+displayRecs*recRange-1) > totalRecs Then
   dx2 = (totalRecs\displayRecs)*displayRecs+1
   dy2 = (totalRecs\displayRecs)+1
  Else
   dx2 = dx1+displayRecs*recRange-1
   dy2 = dy1+recRange-1
  End If
  While x <= totalRecs
   If x >= dx1 AND x <= dx2 Then
    If CLng(startRec) = CLng(x) Then %>
 <font face="Tahoma" size="-1"><b><%=y%></b></font>
    <% Else %>
 <a href="tbl_CTS_informationlist.asp?start=<%=x%>">< ;font face="Tahoma" size="1"><b><%=y%></b></font>< /A>
    <% End If
    x = x + displayRecs
    y = y + 1
   ElseIf x >= (dx1-displayRecs*recRange) AND x <= (dx2+displayRecs*recRange) Then
    If x+recRange*displayRecs < totalRecs Then %>
 <a href="tbl_CTS_informationlist.asp?start=<%=x%>">< ;font face="Tahoma" size="1"><b><%=y%>-<%=y+recRange-1%>< ;/b></font></a>
    <% Else
     ny=(totalRecs-1)\displayRecs+1
      If ny = y Then %>
 <a href="tbl_CTS_informationlist.asp?start=<%=x%>">< ;font face="Tahoma" size="1"><b><%=y%></b></font>< /a>
      <% Else %>
 <a href="tbl_CTS_informationlist.asp?start=<%=x%>">< ;font face="Tahoma" size="1"><b><%=y%>-<%=ny%></b>< ;/font></a>
      <% End If
    End If
    x=x+recRange*displayRecs
    y=y+recRange
   Else
    x=x+recRange*displayRecs
    y=y+recRange
   End If
  Wend
 End If
 ' Next link
 If NOT rsEof Then
  NextStart = startRec + displayRecs
  isMore = True %>
 <a href="tbl_CTS_informationlist.asp?start=<%=NextStart%> "><font face="Tahoma" size="1"><b>Next</b></font></a>
 <% Else
  isMore = False
 End If %>
 <br> 
 <% If CLng(startRec) > CLng(totalRecs) Then startRec = totalRecs
 stopRec = startRec + displayRecs - 1
 recCount = totalRecs - 1
 If rsEOF Then recCount = totalRecs
 If stopRec > recCount Then stopRec = recCount %>
 <font face="Tahoma" size="1"> Records <%= startRec %> to <%= stopRec %> of <%= totalRecs %></font>
<% Else %>
 <font face="Tahoma" size="1">No records found</font>
<% End If %>

Back to Top
msm_eg View Drop Down
Newbie
Newbie
Avatar

Joined: 17 May 2003
Location: Egypt
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote msm_eg Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2003 at 6:30pm

ttttttthhhhank u sir i will try it  and i will tell u :) thank u sir again

Back to Top
msm_eg View Drop Down
Newbie
Newbie
Avatar

Joined: 17 May 2003
Location: Egypt
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote msm_eg Quote  Post ReplyReply Direct Link To This Post Posted: 22 January 2004 at 11:38am

hello i tried to fix the code with my code

what i must to do to make it read my Recordset

and calculate the resulte???

here is my code that i get the data in it to prepare the admin to update the data or delet it

and if ther i get the data i put it in a table

so what if there is 1000 itemes and i dont want all of that come in 1 page

here is

***************** 

 

<%@ Language = "VBScript" %>


<!--#include file="Conn.inc" -->
 <% 
  response.buffer = true  

 

'** Getting the data from the db and order the data by Id des to get  the new at first.

 sql ="select * from Lesson_cat ORDER BY id desc"

 '**Makeing a Record Set to get the Data in it  and make it Execute
 
set rs=conn.execute(sql)

'** Now we are making a Var Id from the data has come from the db and Select statment cuz we will use the Id in the
'** it here to make it go with the form

id        = rs( "id" )

'** Now we will make the cases when we want to get Data
'* the first case when we dont have any data in the Db.!!


if (rs.bof and rs.eof) then

'**here is the resulte when the rs cannt find any data to view it ..

Response.Write("<br><br><center> <font face=""verdana"" size=""2"" color=""red"">Sorry , There is no Category to be able to update it.!!<br><br><a href=""addcat.asp"">add category</a>")

'** and now Here we go with  the other case when we find a data to view...
else
rs.movefirst

'**Now we will draw a table and put the data in it .!!

%>

 

<html>
 <head>
  <link href="../css/style.css" rel="stylesheet" type="text/css">

  <meta http-equiv="Content-Language" content="en-us">
 </head>
<body>
   <center><% do while not rs.eof %>
       <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" bgcolor="#F3F3F3">
         <tr>
            <td width="100%">
              <table border="2" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
               <tr>
                  <td width="15%" align="center" height="27"><b>
                      <font face="Verdana" size="2" color="#FF9900">Category name</font></b></td>
                  <td width="26%" align="center" height="27"><b>
                   <font face="Verdana" size="2" color="#FF9900">Description</font></b></td >
                  <td width="26%" align="center" height="27"><b>
                    <font face="Verdana" size="2" color="#FF9900">The Action</font></b></td>
               </t r>
      <!--the data-->
    
               <tr >
                  <td width="15%" height="47">
                  <center><div id="red">
                  <%=rs("name")%>
                  </div></center>
                  </td>
                  <td width="26%" height="47" align="center"><div id="normal">
                <%=rs("des")%>
                 </div>
                 </td>
                 <td width="26%" height="47">
                     <p align="center">
                  <form method="POST" action="deletcataction.asp?id=<%=rs("id")%>">
                    <p align="center">
                <a href="updatecatform.asp?id=<%=rs("id")%>">Update</a>
                    |
              <input type="submit" value="delete" name="B1" onclick="return confirm('are you sure you want to delet you will delete the lessons under the category too.')" style="font-size: 10px; font-family: Tahoma">
                   </p >
              </form>
            </td>
             </tr>
            </table>
           </td>
        </tr>

    </table>
  <%
rs.movenext
loop

%>

</body>
</html>
<%
end if
rs.close
conn.close
set rs=nothing
set conn=nothing

%>

Back to Top
yessir View Drop Down
Newbie
Newbie


Joined: 02 October 2003
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote yessir Quote  Post ReplyReply Direct Link To This Post Posted: 22 January 2004 at 12:33pm

put this at the top:

 

< %
displayRecs = 10
recRange = 10
% >

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.