Hoşgeldiniz, Ziyaretçi.Lütfen giriş yapın veya kayıt olun.
E-posta adresinize aktivasyon iletisi gelmediyse lütfen buraya tıklayın.
Mayıs 18, 2012, 07:59:21 ÖÖ


FORUM ŞU AN İÇİN (ÖZEL BÖLÜMLER HARİÇ) TÜM ZİYARETÇİLERE AÇIKTIR.
EMEĞE SAYGI AÇISINDAN ALINTILARIN MUTLAKA KAYNAK GÖSTERİLMESİ RİCA OLUNUR.


Ana Sayfa Ana Sayfa Yardım Ara Giriş Yap Kayıt
+  Hay-NS Yazılım
|-+  WEB TABANLI DİLLER
| |-+  ASP Köşesi
| | |-+  ASP Kod Bankası
| | | |-+  Sayfalama Şekilleri -3- fonksiyonlu getrows ile
0 Üye ve 1 Ziyaretçi konuyu incelemekte. « önceki sonraki »
Sayfa: [1] Aşağı git Bu Konuyu Gönder Yazdır
Gönderen Konu: Sayfalama Şekilleri -3- fonksiyonlu getrows ile  (Okunma Sayısı 1239 defa)
turkoder
Adnan YILDIZ
Administrator
Onbaşı
*****

Rep Puanı: +0/-0
Çevrimdışı Çevrimdışı

Mesaj Sayısı: 208



WWW
« : Ekim 09, 2006, 06:36:55 ÖS »

Bu kod vardı ne gerekti diyebilirsiniz. getrows komutu ile veritabanından bir kere veri çekersiniz, ama for veya while döngüleri ile veritabanından irtibatınız işlem bitene kadar bitmez. Bu da performans açısından önemli bir durumdur.

Örnek :

Kod:
<font face="Verdana" size="2" color="#0000FF"><b>Listelenen Kayıtlar :</b></font>
 
 <%
 
id=request.querystring("id")
   intPage = cInt(Request.QueryString("page"))
 If (intPage = 0) or (intpage="") then
 intPage = 1
 end if
liste_say= 7

Set rs=Server.CreateObject("Adodb.Recordset")
Sorgu="Select * from topik where id="&id&" "
'On Error Resume Next
rs.Open Sorgu, bag, 1, 3
If rs.EOF Then
Response.write"İlgili Kayıta rastlanamadı"
response.end
Else
 
messagecount = rs.Recordcount
 
rs.PageSize = cint(liste_say)
rs.AbsolutePage = intPage
sayfa1= rs.PageCount
kayitlar = rs.GetRows(liste_say)
   end if 
 rs.close
 set rs=nothing
%>
<font face="Verdana" size="2"><%=sfysirala()%></font>
 <table border="0" width="100%" style="border-style: solid; border-width: 1" bordercolor="#C0C0C0">
 
 <%
 i=1
 
for j=0 to Ubound(kayitlar,2)
if j<0 then exit for
baslik= kayitlar(5,j)
%>
<%if i mod 2 then
renk="F2F2F2"
else
renk="ffffff"
end if
%>
  <tr>
    <td width="3%" bgcolor="#<%=renk%>"><%response.write i%></td>
    <td width="97%" bgcolor="#<%=renk%>" colspan="2"><%=baslik%></td>
  </tr>
<% 
  i=i+1
   
  next
           
               
%> <tr>
    <td width="3%" bgcolor="#<%=renk%>">   
</td>
    <td width="24%" bgcolor="#<%=renk%>"><font face="Verdana" size="2"> <b>Toplam Kayıt:</b>&nbsp;<%=messagecount%> </font></td>
    <td width="73%" bgcolor="#<%=renk%>"><font face="Verdana" size="2"><%=sfysirala()%></font> </td>
  </tr>
</table>

Fonksiyonumuz :

 
Kod:
<%
Function sfysirala()
If (messagecount/ liste_say) <> Fix(messagecount/ liste_say) then
intposts = Fix(messagecount/ liste_say) + 1
else
intposts = (messagecount/ liste_say)
end if
if intPosts >= 1 then
Sayfa="Sayfa"
Response.Write "<br /><div style=""text-align=right;""><span class=""stort"">" & Sayfa & ": " & intPosts & " (</span>"
If intPage > 1 Then
Response.Write "<a href=""?page=1" & "&id=" & id& """> İlk Sayfa  </a> ... "
 Response.write "<a href=""?page=" & intPage-1 & "&id=" & id& """><<</a> "
End If
For i = intpage-4 to intpage+4
If i > intPosts Then Exit For
if  i <> cint(intPage) Then
If i >= 1 Then
 response.write "<a href=""?page=" & i &"&id=" & id& """>" & i & "</a> "
End If
else
response.write "&nbsp;<a href=""#"">[" & i & "]</a> "

end if
Next
If intPage + 1 =< intposts Then

 Response.write "<a href=""?page=" & intPage+1 &"&id=" & id& """>>></a> "
 
Response.write " ... <a href=""?page=" & intPosts &"&id=" & id& """>Son Sayfa</a>"

End if

Response.Write "<span class=""stort"">)</span></div>"
end if

 
End Function
 
%>
« Son Düzenleme: Ekim 09, 2006, 06:40:59 ÖS Gönderen: Turkoder (Menderes) » Logged
Sayfa: [1] Yukarı git Bu Konuyu Gönder Yazdır 
« önceki sonraki »
Gitmek istediğiniz yer:  


Kullanıcı adınızı, parolanızı ve aktif kalma süresini giriniz

MySQL Kullanıyor PHP Kullanıyor Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC XHTML 1.0 Uyumlu! CSS Uyumlu!
Bu Sayfa 0.044 Saniyede 19 Sorgu ile Oluşturuldu