Afficher 10 lignes

cs_Dellys Messages postés 95 Date d'inscription mercredi 26 octobre 2005 Statut Membre Dernière intervention 24 mars 2008 - 22 déc. 2005 à 12:02
cs_Dellys Messages postés 95 Date d'inscription mercredi 26 octobre 2005 Statut Membre Dernière intervention 24 mars 2008 - 29 déc. 2005 à 10:57
Bonjour

Voila j'ai une boucle qui affiche des enregistrement sur un tableau ,ce que je veut c'est que méme si il ya moins de 10 enregistremts le tableau s'affiche avec 10 lignes
la boucle

while not objRS.eof

response.write "<tr><TD bgcolor =#E2ECF5 height=41 style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;>" &objrs("etablis_payeur")&"</TD>"

objrs.movenext
loop

2 réponses

Arto_8000 Messages postés 1044 Date d'inscription lundi 7 mars 2005 Statut Membre Dernière intervention 13 juillet 2010 7
23 déc. 2005 à 04:51
Dim i as integer
i = 1

While (not objRS.eof && i < 11)
response.write "<tr><td bgcolor =#E2ECF5 height=41 style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;>" & objRS("etablis_payeur")& "</td>"
objRS.Movenext
i = i + 1
Loop

If not i = 10 Then
Dim x as Integer
For x = i to 10
response.write("<tr><td></td></tr>")
Next x
End if

Premièrement on effectue ta boucle habituel, mais on compte le nombre d'enregistrement et deuxième on affiche les lignes manquantes selon le nombre d'enregistrement compté.

J'ai pas testé parce que j'ai pas ASP.net, mais l'algorythme devrait être bon et fait attention on ne mélange pas des balises en majuscules et en minuscule en même temps.
0
cs_Dellys Messages postés 95 Date d'inscription mercredi 26 octobre 2005 Statut Membre Dernière intervention 24 mars 2008
29 déc. 2005 à 10:57
Bonjour
j'ai un petit probléme , sans la pagination ca marche mais avec ca marche pas
voici le code complet

dim nmax,ncur,ndeb,Npag

Nmax = 10 ' nombre par page -----------------------pagination-----
Ncur = 0 ' n° de la fiche courante
Ndeb = 0 ' 1ère fiche transmise par l'URL


if request.queryString("num")<>"" then _
Ndeb = Cint(request.queryString("num"))



dim o,s
s=0
o=0


while (not objRS.eof and Ncur<Nmax+Ndeb and s < 10)

if Ncur >= Ndeb then



response.write "<tr><TD bgcolor =#E2ECF5 height= style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;><center>" &objrs("etablis_payeur")&" N°: "&objrs("NUM_AGENCE")&"</TD>"
response.write "<TD bgcolor =#E2ECF5 style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1;border-color:black; border-style:solid;><center>" &objrs("nom_tireur")&"</TD>"
response.write "<TD bgcolor =#E2ECF5 style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;><center>" &objrs("num_cheque")&"</TD>"
response.write "<TD bgcolor =#E2ECF5 style=border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:black; border-style:solid;><center>" &CCUR(objrs("montant_cheque"))&"</TD>"


end if

objrs.movenext
Ncur = Ncur + 1
s=s+1
wend
If not s = 10 Then
Dim x
For x = s to 10
response.write("<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>")
Next


End if


response.write"Nombre :"&objrs.recordcount&"

"


%>
</tr>
<tr><td colspan="3" width="206" bordercolor="#FFFFCC" height="1"> &nbsp;</td>
<td width="86" bordercolor="#FFFFCC" height="1" bgcolor="#FFFFCC"> <%response.write objrsg("g")%>
DZD</td>
</tr>
</table>
&nbsp;&nbsp;<%%><%
if Ndeb > 0 then%>

<table>
<td valign=top height="22">

[?num=<%=Ndeb-Nmax%> Retour]
</td>
<%end if%>
<td height="22">
<% ' N° des pages
Npag = int(objRS.recordCount/Nmax)
if Npag < objRS.recordCount/Nmax then Npag = Npag + 1
dim i
for i = 1 to Npag
' Page courante ?
if Ndeb = (i-1)*Nmax then%>
Page <%=i%>
<%else%>
[?num=<%=(i-1)*Nmax%> &nbsp;<%=i%>&nbsp;]
<%end if
next%>

</td>
<% ' Des fiches après ?
if not objRS.eof then%>
<td valign=top height="22">

[?num=<%=Ncur%> Suite]
</td>
<%
end if
0
Rejoignez-nous