Wie kan mij het volgende uitleggen om onderstaande ASP-Scritp zó om te bouwen dat hij niet ALLE records uit de database (GeleKaart) vertoond, maar alleen als er bij de "Afsluitdatum" niets is ingevuld.
Ik heb zelf een "If else end if" gemaakt, dit werkt wel, maar dan werkt het stukje code niet meer om maar bijv. 5 record per pagina te geven. Hij geeft er dan wel 5 maar als je naar de andere pagina's gaat klopt het niet meer.
Wie kan mij helpen om dit aan te passen!
Alvast bedankt voor de moeite
ASP-Script wat ik nu gebruikt:
<% Session.LCID = 1043 %>
<meta http-equiv="Content-Language" content="nl">
<title>GTI - GeleKaart</title>
<body bgproperties="fixed" background="../images/gr_wt_achter.gif">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="36%">
[img]"../images/logo_schaduw.gif"[/img]</td>
<td width="64%"><b><font face="Arial" size="4">GeleKaart<u><br>
</u></font></b><font face="Courier New" size="2"><a href="GeleKaart.asp">Hoofdmenu</a></font><font face="Arial" size="2">
\ </font><font face="Courier New" size="2"> <a href="ogk.asp">Onderhoud gele kaarten</a></font><font face="Arial" size="2"> \ <font color="#FF0000"><b>
Alle ordernummers</b></font></font></td>
</tr>
</table>
</div>
<div align="center">
<hr>
</div>
<br>
<%
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
Const adCmdFile = &H0100
Const adCmdTableDirect = &H0200
Dim PageLength, NumPages, CurrentPage
Select Case Request.Cookies("GTIGK")("AantalPP")
Case "5"
PageLength = 5
Case "10"
PageLength = 10
Case "15"
PageLength = 15
Case "20"
PageLength = 20
Case "25"
PageLength = 25
Case "30"
PageLength = 30
Case "40"
PageLength = 40
Case "50"
PageLength = 50
Case "999999"
PageLength = 999999
Case else
PageLength = 15
end Select
If Request.QueryString("page") = "" Then
CurrentPage = 1
Else
CurrentPage = CInt(Request.QueryString("page"))
End If
SQL_STRING = "SELECT * FROM GeleKaart ORDER BY OrderNummer"
DSN_CONN_STRING="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN_CONN_STRING=DSN_CONN_STRING & "DBQ=" & server.mappath("dbase/GeleKaart.mdb")
set DB_CONN=server.createobject("ADODB.Connection")
DB_CONN.Open DSN_CONN_STRING
Set RS = Server.CreateObject("ADODB.Recordset")
RS.PageSize = PageLength
RS.CacheSize = PageLength
RS.Open SQL_STRING, DB_CONN, adOpenStatic, adLockReadOnly, adCmdText
NumPages = RS.PageCount
If CurrentPage > NumPages Then CurrentPage = NumPages
If CurrentPage < 1 Then CurrentPage = 1
If NumPages = 0 Then
Response.Write "Geen records gevonden."
Else
RS.AbsolutePage = CurrentPage
%>
<div align="center">
<center>
<table border=0 cellpadding="4">
<tr>
<td bgcolor="#000080"><b><font face="Verdana" size="2" color="#FFFFFF"><%=RS("OrderNummer").name %></font></b></td>
<td bgcolor="#000080"><b><font color="#FFFFFF"><font face="Verdana" size="2" color="#FFFFFF"><%=RS("Opdrachtgever").name %></font></font></b></td>
<td bgcolor="#000080"><b><font color="#FFFFFF"><font face="Verdana" size="2" color="#FFFFFF"><%=RS("ProjectNaam").name %></font></font></b></td>
</tr>
<%
' Lees de records
RecordCount = 0
Do While RecordCount < PageLength And Not RS.eof
%>
<tr>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFCC"><font face="Courier New" size="2"><%=RS("OrderNummer")%></font></td>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFFF"><font face="Courier New" size="2"><%=RS("Opdrachtgever")%></font></td>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFCC"><font face="Courier New" size="2"><%=RS("ProjectNaam")%></font></td>
</tr>
<%
RecordCount = RecordCount + 1
RS.movenext
loop
End If
RS.close
set RS = nothing
DB_CONN.close
set DB_CONN = nothing
%>
<tr><td align="left" colspan="5">
<hr noshade size="1" color="#000000">
</td>
</tr>
<tr><td align="center" colspan="5" valign="top">
<font face="Arial" size="2"><b>
<%
If CurrentPage > 1 then %>
<a href="ogk_ao.asp?page=<%=CurrentPage - 1%>"><-- vorige</a>
<%End If%>
<% if NumPages > 1 then %>
<%For i = 1 to NumPages %>
<%if i = CurrentPage then%>
| <b><%=i%></b>
<%else%>
| <a href="ogk_ao.asp?page=<%=i%>"><%=i%></a>
<%end if%>
<% next %>|
<%end if%>
<%
If CurrentPage < NumPages Then %>
<a href="ogk_ao.asp?page=<%=CurrentPage + 1%>">volgende --></a>
<%
End If
%>
</table>
<p align="center"><font face="Arial" size="2">
<a href="cookies.asp?CookieAanpassen=1&redir=ogk_ao.asp"><font color="#000080">
Persoonlijke instellingen wijzigen</font></a></font></p>
<hr>
<table border="0" cellspacing="0" width="100%" id="AutoNumber5" cellpadding="0">
<tr>
<td width="100%">
<p align="center"><font face="Verdana" color="#000080" size="1">Copyright © 2001
- <a style="TEXT-DECORATION: none" href="mailto:mpolderdijk@gti-group.com">
<font color="#000080">Maarten Polderdijk</font></a><br>
GTI Rotterdam Industrie bv<br>
Afd. ICT-Beheer</font></p>
</td>
</tr>
</table>
</div>
Ik heb zelf een "If else end if" gemaakt, dit werkt wel, maar dan werkt het stukje code niet meer om maar bijv. 5 record per pagina te geven. Hij geeft er dan wel 5 maar als je naar de andere pagina's gaat klopt het niet meer.
Wie kan mij helpen om dit aan te passen!
Alvast bedankt voor de moeite
ASP-Script wat ik nu gebruikt:
<% Session.LCID = 1043 %>
<meta http-equiv="Content-Language" content="nl">
<title>GTI - GeleKaart</title>
<body bgproperties="fixed" background="../images/gr_wt_achter.gif">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="36%">
[img]"../images/logo_schaduw.gif"[/img]</td>
<td width="64%"><b><font face="Arial" size="4">GeleKaart<u><br>
</u></font></b><font face="Courier New" size="2"><a href="GeleKaart.asp">Hoofdmenu</a></font><font face="Arial" size="2">
\ </font><font face="Courier New" size="2"> <a href="ogk.asp">Onderhoud gele kaarten</a></font><font face="Arial" size="2"> \ <font color="#FF0000"><b>
Alle ordernummers</b></font></font></td>
</tr>
</table>
</div>
<div align="center">
<hr>
</div>
<br>
<%
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
Const adCmdFile = &H0100
Const adCmdTableDirect = &H0200
Dim PageLength, NumPages, CurrentPage
Select Case Request.Cookies("GTIGK")("AantalPP")
Case "5"
PageLength = 5
Case "10"
PageLength = 10
Case "15"
PageLength = 15
Case "20"
PageLength = 20
Case "25"
PageLength = 25
Case "30"
PageLength = 30
Case "40"
PageLength = 40
Case "50"
PageLength = 50
Case "999999"
PageLength = 999999
Case else
PageLength = 15
end Select
If Request.QueryString("page") = "" Then
CurrentPage = 1
Else
CurrentPage = CInt(Request.QueryString("page"))
End If
SQL_STRING = "SELECT * FROM GeleKaart ORDER BY OrderNummer"
DSN_CONN_STRING="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN_CONN_STRING=DSN_CONN_STRING & "DBQ=" & server.mappath("dbase/GeleKaart.mdb")
set DB_CONN=server.createobject("ADODB.Connection")
DB_CONN.Open DSN_CONN_STRING
Set RS = Server.CreateObject("ADODB.Recordset")
RS.PageSize = PageLength
RS.CacheSize = PageLength
RS.Open SQL_STRING, DB_CONN, adOpenStatic, adLockReadOnly, adCmdText
NumPages = RS.PageCount
If CurrentPage > NumPages Then CurrentPage = NumPages
If CurrentPage < 1 Then CurrentPage = 1
If NumPages = 0 Then
Response.Write "Geen records gevonden."
Else
RS.AbsolutePage = CurrentPage
%>
<div align="center">
<center>
<table border=0 cellpadding="4">
<tr>
<td bgcolor="#000080"><b><font face="Verdana" size="2" color="#FFFFFF"><%=RS("OrderNummer").name %></font></b></td>
<td bgcolor="#000080"><b><font color="#FFFFFF"><font face="Verdana" size="2" color="#FFFFFF"><%=RS("Opdrachtgever").name %></font></font></b></td>
<td bgcolor="#000080"><b><font color="#FFFFFF"><font face="Verdana" size="2" color="#FFFFFF"><%=RS("ProjectNaam").name %></font></font></b></td>
</tr>
<%
' Lees de records
RecordCount = 0
Do While RecordCount < PageLength And Not RS.eof
%>
<tr>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFCC"><font face="Courier New" size="2"><%=RS("OrderNummer")%></font></td>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFFF"><font face="Courier New" size="2"><%=RS("Opdrachtgever")%></font></td>
<td Style="cursor:hand" OnClick="javascript:location.href='ogk_bekijken.asp?terug=ogk_ao.asp?<%=Request.ServerVariables("QUERY_STRING")%>&onum=<%=RS("OrderNummer")%>'" valign=top bgcolor="#FFFFCC"><font face="Courier New" size="2"><%=RS("ProjectNaam")%></font></td>
</tr>
<%
RecordCount = RecordCount + 1
RS.movenext
loop
End If
RS.close
set RS = nothing
DB_CONN.close
set DB_CONN = nothing
%>
<tr><td align="left" colspan="5">
<hr noshade size="1" color="#000000">
</td>
</tr>
<tr><td align="center" colspan="5" valign="top">
<font face="Arial" size="2"><b>
<%
If CurrentPage > 1 then %>
<a href="ogk_ao.asp?page=<%=CurrentPage - 1%>"><-- vorige</a>
<%End If%>
<% if NumPages > 1 then %>
<%For i = 1 to NumPages %>
<%if i = CurrentPage then%>
| <b><%=i%></b>
<%else%>
| <a href="ogk_ao.asp?page=<%=i%>"><%=i%></a>
<%end if%>
<% next %>|
<%end if%>
<%
If CurrentPage < NumPages Then %>
<a href="ogk_ao.asp?page=<%=CurrentPage + 1%>">volgende --></a>
<%
End If
%>
</table>
<p align="center"><font face="Arial" size="2">
<a href="cookies.asp?CookieAanpassen=1&redir=ogk_ao.asp"><font color="#000080">
Persoonlijke instellingen wijzigen</font></a></font></p>
<hr>
<table border="0" cellspacing="0" width="100%" id="AutoNumber5" cellpadding="0">
<tr>
<td width="100%">
<p align="center"><font face="Verdana" color="#000080" size="1">Copyright © 2001
- <a style="TEXT-DECORATION: none" href="mailto:mpolderdijk@gti-group.com">
<font color="#000080">Maarten Polderdijk</font></a><br>
GTI Rotterdam Industrie bv<br>
Afd. ICT-Beheer</font></p>
</td>
</tr>
</table>
</div>