Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/06/2006, 20h48   #1
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
Par défaut problème d'actualisation avec la pagination

salut tt le monde et voila je ss de retour mon problème cette fois c'est la pagination j'ai des enregistrement, quand je veus les lister sur une page asp tout va b1 voila mon code

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
<html>
<body>
<%
Select Case Request.QueryString("Direction")
Case ""
Session("CurrentPage") = 1
Case "Next"
Session("CurrentPage") = Session("CurrentPage") + 1
Case "Prev"
Session("CurrentPage") = Session("CurrentPage") - 1
End Select
Const adOpenKeyset = 1
Set objConnection = Server.CreateObject("ADODB.Connection")
OBJConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\bendi.mdb;Persist Security Info=False"
Dim strSQL
strSQL = strSQL & "SELECT * FROM tblClient order by codeClient"
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.PageSize = 5
objRecordset.Open strSQL, objConnection, adOpenKeyset
objRecordset.AbsolutePage = CLng(Session("CurrentPage"))
%>
 
<%
Dim i
For i = 1 To objRecordset.PageSize
%>
<% =objRecordset("nomClient") %>&nbsp;<% =objRecordset("prenomClient") %><br>
<% objRecordset.MoveNext
If objRecordset.EOF then
exit for
End If
Next
%>
 
<%If CLng(Session("CurrentPage")) > 1 Then %>
<a href="modifier_client.asp?Direction=Prev">Enregistrements précédents</a>
<% End If %>
<%If CLng(Session("CurrentPage")) < objRecordset.Pagecount Then %>
<a href="modifier_client.asp?Direction=Next">Enregistrements suivants</a>
<% End If %>
 
 
<%
objRecordset.Close
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing
%> 
 
 
</body>
</html>
voila mon prob
quand je liste tout les enregistrement de ma table j'obtient ce que je veus quand j'actualise dans la première page pas de problème mais quand je passe a la seconde et j'actualise la page suivante s'affiche donc a chaque actualistaion je me suit conduit vers la page suivante et quand j'arrive a la dernière voila l'erreur qui s'affiche :

ADODB.Field error '80020009'

BOF ou EOF est égal à True ou l'enregistrement actuel a été supprimé. L'opération demandée nécessite un enregistrement actuel.

/avant/modifier_client.asp, line 0


si vous m'aidez je serais reconnaissant

MERCI d'avance
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/06/2006, 22h37   #2
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Plutôt que
Code :
For i = 1 To objRecordset.PageSize
Pourquoi pas
Code :
1
2
 
WHILE NOT objRecordset.EOF and i <= objRecordset.PageSize
A+
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/06/2006, 00h56   #3
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
bsr et merci pour votre reponse

je suis encore débutant et je n'utilse pas trop la boucle while not

alors est ce que vous pouvez me récrire la boucle compléte plz

merci
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/06/2006, 09h51   #4
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Code :
1
2
3
4
5
6
7
8
9
 
i = 0
WHILE NOT objRecordset.EOF and i <= objRecordset.PageSize
 
    (...TRAITEMENT ...)
 
    i = i + 1
    objRecordset.movenext
WEND
A+
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/06/2006, 16h15   #5
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
le meme prob

voila l erreur
ADODB.Field error '80020009'

BOF ou EOF est égal à True ou l'enregistrement actuel a été supprimé. L'opération demandée nécessite un enregistrement actuel.

/avant/modifier_client.asp, line 0


quand j'affiche les résultats pour la première fois c'est bien mais quand je passe a la deuxième et j'acctualise je passe a la 3éme automatiqement et comme ça jusqua la fin puis il m'afiche l'erreur précédente.
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/06/2006, 23h34   #6
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Montre le morceau de code avec ta correction STP.
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 29/06/2006, 13h57   #7
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
bjr
le voila
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 
<html>
<body>
 
 
 
 
<%
Select Case Request.QueryString("Direction")
Case ""
Session("CurrentPage") = 1
Case "Next"
Session("CurrentPage") = Session("CurrentPage") + 1
Case "Prev"
Session("CurrentPage") = Session("CurrentPage") - 1
End Select
Const adOpenKeyset = 1
Set objConnection = Server.CreateObject("ADODB.Connection")
OBJConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\bendi.mdb;Persist Security Info=False"
Dim strSQL
strSQL = strSQL & "SELECT * FROM tblClient order by codeClient"
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.PageSize = 3
objRecordset.Open strSQL, objConnection, adOpenKeyset
objRecordset.AbsolutePage = CLng(Session("CurrentPage"))
%>
 
 
 
 
 
<%
 
dim i
 
i = 0
while not objRecordset.EOF AND i<= objRecordset.PageSize %>
<% =objRecordset("nomClient") %>&nbsp;<% =objRecordset("prenomClient") %><br>
<% 
i=i+1
objRecordset.MoveNext
wend
 
%>
 
 
<%If CLng(Session("CurrentPage")) > 1 Then %>
<a href="modifier_client.asp?Direction=Prev">Enregistrements précédents</a>
<% End If %>
<%If CLng(Session("CurrentPage")) < objRecordset.Pagecount Then %>
<a href="modifier_client.asp?Direction=Next">Enregistrements suivants</a>
<% End If %>
 
 
<%
objRecordset.Close
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing
%> 
 
 
</body>
</html>
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/06/2006, 22h18   #8
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Ton code fonctionne bien chez moi.
J'ai corrigé des trucs, regarde bien. En passant, evite de mélanger le code HTML avec l'ASP. C'est sale...
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<%
Dim strSQL
 
Const adOpenKeyset = 1
 
Set objConnection = Server.CreateObject("ADODB.Connection")
OBJConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\bendi.mdb;Persist Security Info=False"
 
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.PageSize = 3
objRecordset.Open "SELECT * FROM tblClient order by codeClient", objConnection, adOpenKeyset
 
dim i, PageNum
i = 0
 
IF request.QueryString("PageNum") <> "" THEN
	IF objRecordset.AbsolutePage <= objRecordset.pagecount THEN
		objRecordset.AbsolutePage = request.QueryString("PageNum")
		PageNum = request.QueryString("PageNum")
	END IF
ELSE
	PageNum = 1
END IF
 
IF NOT objRecordset.EOF AND NOT objRecordset.BOF THEN
	while not objRecordset.EOF AND i<= objRecordset.PageSize
		response.Write(objRecordset("nomClient") & "&nbsp;" & objRecordset("prenomClient") &"<br>")
		i=i+1
		objRecordset.MoveNext
	wend
ELSE
	response.Write("Pas d'enregistrements")
END IF
response.Write("You are page " & PageNum & " of " & objRecordset.Pagecount & "<br>")
If cint(PageNum) > 1 Then
	response.Write("<a href='Untitled-2.asp?Direction=Prev&PageNum=" & PageNum - 1 & "'>Enregistrements précédents</a>&nbsp;")
End If
If cint(PageNum) < objRecordset.Pagecount Then
	response.Write("<a href='Untitled-2.asp?Direction=Next&PageNum=" & PageNum + 1 & "'>Enregistrements suivants</a>")
End If
 
objRecordset.Close
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing
%>
A+
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/07/2006, 02h23   #9
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
resalut
maintenant il maffiche les résultats mais quand je click sur le lien enregistrement suivant

il maffiche

La page est introuvable
Il se peut que la page que vous recherchez ait été supprimée, ait changé de nom ou soit momentanément indisponible.
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/07/2006, 13h57   #10
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Et à ton avis...
Code :
href='Untitled-2.asp?Direction
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/07/2006, 14h33   #11
Candidat au titre de Membre du Club
 
Inscription : mai 2006
Messages : 23
Détails du profil
Informations forums :
Inscription : mai 2006
Messages : 23
Points : 12
Points : 12
r1 à dir

super bon merci pour tt mon frére tu es très gentille

a+
momov est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h35.


 
 
 
 
Partenaires

Hébergement Web