Hi!
I've tried adding paging code to my asp file, so that is brings back 10 records per page. However, i've come across a problem with page - I get the following error ;
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/Miller_Local/Test.asp, line 65, column 78
response.write "<a href=""test.asp?sqlQuery=" & request.querystring("Query"
&
-----------------------------------------------------------------------------^
Can anyone see what i'm doing wrong (I've only just started using ASP).
The asp page code is:
<%@ Language=VBScript %>
<% ' Response.buffer = false %>
<html>
<link rel="stylesheet" type="text/css" href="stylesheets/Application.css">
<head>
<!--#INCLUDE FILE="codeblocks/db.asp"-->
<!--#INCLUDE FILE="codeblocks/HoverOver.htm"-->
</head>
<body topMargin="0" leftMargin="0" rightMargin="0" bottomMargin="0">
<!--#INCLUDE FILE="codeblocks/pageheader.htm"-->
<table border="0" cellSpacing="0" cellPadding="0" width="100%">
<thead>
<tr height="28"><td class="header" COLSPAN="4" style="font-size: 18">Contracts</td></tr>
<tr height="12">
<td style="width: 100">Contract</td>
<td>Description</td>
<td style="width: 40">Year</td>
<td style="width: 80">Agent</td>
</tr>
</thead>
<% dim oRS, i
set oRS = OpenDBQuery("Select top 250 * From Contract"
dim currentpage, a, pagenumber
If isempty(Request.Querystring("PageNumber"
) then
CurrentPage =1
else
currentPage = Cint(Request.Querystring("PageNumber"
)
end if
response.write "Page " & currentpage
if oRS.EOF or oRS.BOF then
%><br>
<font size="2" color="#ff0000">
<%
response.write "Please choose an item from the list then click 'GO'"
%>
</font>
<%
else
oRS.pagesize = 10
oRS.absolutepage = currentpage
do until oRS.absolutepage <> currentpage or oRS.EOF
%>
<%
i=0
while not oRS.EOF %>
<tr class="TR<%=((i mod 2)+1)%>" style="height: 17px"
onClick="window.location.href='Test2.asp?Contract=<%=Server.URLEncode(oRS.Fields("bindno"
)%>&Year=<%=oRS.Fields("bindyr"
%>'"
onMouseOver="Javascript:SelectionHoverOver(this,true);"
onMouseOut="Javascript:SelectionHoverOut(this,<%=((i mod 2)+1)%>);">
<td><%=oRS.Fields("bindno"
%></td>
<td><%=oRS.Fields("binddesc"
%></td>
<td><%=oRS.Fields("bindyr"
%></td>
<td><%=oRS.Fields("Agent"
%></td>
</tr>
<% i=i+1
oRS.MoveNext
wend
response.write "select page to view more distributors:"
For i = 1 to oRS.pagecount
response.write "<a href=""test.asp?sqlQuery=" & request.querystring("Query"
&
"&PageNumber=" & i & """>" & i & " </a>"
next
oRS.close
set oRS = nothing
%>
</table>
<!--INCLUDE FILE="codeblocks/pagefooter.htm"-->
</body>
</html>
Thankyou,
Julie
I've tried adding paging code to my asp file, so that is brings back 10 records per page. However, i've come across a problem with page - I get the following error ;
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/Miller_Local/Test.asp, line 65, column 78
response.write "<a href=""test.asp?sqlQuery=" & request.querystring("Query"
-----------------------------------------------------------------------------^
Can anyone see what i'm doing wrong (I've only just started using ASP).
The asp page code is:
<%@ Language=VBScript %>
<% ' Response.buffer = false %>
<html>
<link rel="stylesheet" type="text/css" href="stylesheets/Application.css">
<head>
<!--#INCLUDE FILE="codeblocks/db.asp"-->
<!--#INCLUDE FILE="codeblocks/HoverOver.htm"-->
</head>
<body topMargin="0" leftMargin="0" rightMargin="0" bottomMargin="0">
<!--#INCLUDE FILE="codeblocks/pageheader.htm"-->
<table border="0" cellSpacing="0" cellPadding="0" width="100%">
<thead>
<tr height="28"><td class="header" COLSPAN="4" style="font-size: 18">Contracts</td></tr>
<tr height="12">
<td style="width: 100">Contract</td>
<td>Description</td>
<td style="width: 40">Year</td>
<td style="width: 80">Agent</td>
</tr>
</thead>
<% dim oRS, i
set oRS = OpenDBQuery("Select top 250 * From Contract"
dim currentpage, a, pagenumber
If isempty(Request.Querystring("PageNumber"
CurrentPage =1
else
currentPage = Cint(Request.Querystring("PageNumber"
end if
response.write "Page " & currentpage
if oRS.EOF or oRS.BOF then
%><br>
<font size="2" color="#ff0000">
<%
response.write "Please choose an item from the list then click 'GO'"
%>
</font>
<%
else
oRS.pagesize = 10
oRS.absolutepage = currentpage
do until oRS.absolutepage <> currentpage or oRS.EOF
%>
<%
i=0
while not oRS.EOF %>
<tr class="TR<%=((i mod 2)+1)%>" style="height: 17px"
onClick="window.location.href='Test2.asp?Contract=<%=Server.URLEncode(oRS.Fields("bindno"
onMouseOver="Javascript:SelectionHoverOver(this,true);"
onMouseOut="Javascript:SelectionHoverOut(this,<%=((i mod 2)+1)%>);">
<td><%=oRS.Fields("bindno"
<td><%=oRS.Fields("binddesc"
<td><%=oRS.Fields("bindyr"
<td><%=oRS.Fields("Agent"
</tr>
<% i=i+1
oRS.MoveNext
wend
response.write "select page to view more distributors:"
For i = 1 to oRS.pagecount
response.write "<a href=""test.asp?sqlQuery=" & request.querystring("Query"
"&PageNumber=" & i & """>" & i & " </a>"
next
oRS.close
set oRS = nothing
%>
</table>
<!--INCLUDE FILE="codeblocks/pagefooter.htm"-->
</body>
</html>
Thankyou,
Julie