codice:
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001
Const PAGE_SIZE = 5
Dim strURL
Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file
Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being looked for
Dim iPageCurrent ' The page we're currently on
Dim iPageCount ' Number of pages of records
Dim iRecordCount ' Count of the records returned
Dim I ' Standard looping variable
strURL = Request.ServerVariables("URL")
strSearch = Request.QueryString("search")
strSearch = Replace(strSearch, "'", "''")
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
%><center>
<form action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>" />
<input type="submit" />
</form></center>
<%
If strSearch <> "" Then
Set cnnSearch = Server.CreateObject("ADODB.Connection")
cnnSearch.Open "driver={Microsoft Access Driver...............
strSQL = "SELECT * " _
& "FROM controllo " _
& "WHERE destinatario LIKE '%" & strSearch & "%' " _
& "ORDER BY destinatario"
Set rstSearch = Server.CreateObject("ADODB.Recordset")
rstSearch.PageSize = PAGE_SIZE
rstSearch.CacheSize = PAGE_SIZE
rstSearch.Open strSQL, cnnSearch, adOpenStatic, adLockReadOnly, adCmdText
iRecordCount = rstSearch.RecordCount
iPageCount = rstSearch.PageCount
If iRecordCount = 0 Then
%>
No records found. Please try again.
<%
Else
rstSearch.AbsolutePage = iPageCurrent
response.Write("rigo 117")
response.Write("
")
response.Write("rstSearch.AbsolutePage = iPageCurrent" )
response.Write("
")
response.Write("rstSearch.AbsolutePage :" &rstSearch.AbsolutePage)
response.Write(" = ")
response.Write("iPageCurrent :" &iPageCurrent)
response.Write("
")
%>
<%= iRecordCount %> Records Found.
Displaying page <%= iPageCurrent %>
of <%= iPageCount %>:
<table>
<tr>
<td width="93"><div align="center">Data</div></td>
<td width="73"><div align="center">CV</div></td>
<td width="201"><div align="center">Destinatario</div></td>
<td width="143"><div align="center">Oggetto</div></td>
<td width="186"><div align="center">Messaggio</div></td>
</tr>
<%
response.Write("rigo 149")
response.Write("
")
response.Write("rstSearch.AbsolutePage" &rstSearch.AbsolutePage)
response.Write("
")
response.Write("iPageCurrent" &iPageCurrent)
response.Write("
")
Do While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
%>
<tr>
<td><%= rstSearch.Fields("data").Value %> <div align="center"></div></td>
<td><%= rstSearch.Fields("curriculum").Value %> <div align="center"></div></td>
<td><%= rstSearch.Fields("destinatario").Value %></td>
<td><%= rstSearch.Fields("oggetto").Value %></td>
<td><%= rstSearch.Fields("messaggio").Value %></td>
</tr>
<%
rstSearch.MoveNext
Loop
%>
</table>
<center>
Come si puo notare dal codice hce ho postato (scusate se è un po lungo)
sia rstSearch.AbsolutePage che iPageCurrent sono settate....