Forum Moderators: open
I'M REALLY SORRY ABOUT THE LENGTH OF THE CODE, BUT I THINK ITS ALL NECESSARY IF ANYONE IS TO HELP
______________________________________________________
The problem is when i run the page, it displays multiple pages fine, but the script for some reason give me a link to a page '0' which gives the following error:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another
and a last page numbered whatever that gives this error
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
The code for the page is as follows:
______________________________________________________
<!-- #INCLUDE FILE="adovbs.inc" -->
<%
' Retrieves the current page
pg = TRIM( Request( "pg" ) )
IF pg = "" THEN pg = 1
'Open the recordset
Set prodRS = Server.CreateObject( "ADODB.Recordset" )
prodRS.ActiveConnection = Con
prodRS.CursorType = adOpenStatic
prodRS.PageSize = 5
sql = "SELECT product_id, product_picture, product_name, product_briefDesc, product_category, product_price " &_
"FROM Products WHERE product_category='" & cat & "' " &_
"AND product_status=1 " &_
"ORDER BY product_name "
prodRS.Open sql
prodRS.AbsolutePage = pg
%>
<table width="96%" border=0
cellpadding=5 cellspacing=0>
<%
WHILE NOT prodRS.EOF AND rowCount < prodRS.PageSize
rowCount = rowCount + 1
%>
<tr>
<td width="21%" rowspan="6">
<% IF prodRS( "product_picture" ) <> "?" THEN %>
<IMG SRC="<%=prodRS( "product_picture" )%>"
HSPACE=4 VSPACE=4 BORDER=0 align="center" height="150" width="100"><% END IF %>
</td>
</tr>
<tr>
<td colspan="2">
<a href="product.asp?pid=<%=prodRS( "product_id" )%>" target="_blank">
<b><%=prodRS( "product_name" )%></b></a>
<div align="right"></td>
</tr>
<td width="33%"> </td>
<td width="46%" align="right">
<em>Category:</em> <font color="#33547B"><strong><%=prodRS( "product_category" )%></strong></font></div>
</td>
</tr>
<tr>
<td colspan="2">
<%=prodRS( "product_briefDesc" )%>
</td>
</tr>
<tr>
<td colspan="1">
<a href="product.asp?pid=<%=prodRS( "product_id" )%>" target="_blank">
<strong>Get More Information</strong></a>
</td>
<td>
<div align="right"><span style="font-weight: bold; color: #33547B;"><i>MovieNation Price:</span> <b><font color="#FF9966">£<%=prodRS( "product_price" )%></font></i></b></div>
</td>
</tr>
<tr>
<%
prodRS.MoveNext
WEND
%>
</table>
<%
IF prodRS.PageCount > 1 THEN
%>
<font color="#3366FF">
<b>Go To Page:</b>
<%
FOR i = i to ProdRS.PageCount
IF i <> cINT( pg ) THEN
%>
<a href="dvdhome.asp?cat=<%=prodRS( "product_category" )%>&pg=<%=i%>">
<%=i%></a>
<% ELSE %>
<b> <%=i%> </b>
<%
END IF
%>
<%
NEXT
%>
</font>
<%
END IF
%>
Please help me, i just can't see whats causing it
Thankyou
Tom
0 1 2 3 4
With the first and last page giving the respected errors mentioned in my first post, i suppose its not a big thing, but i have to hand this in on Wednesday for a project and well thought they might penalise me for a simple error like this.
Hope you can help
Thanks
Tom
1. close your RS. and set to nothing
and close your Con and set to nothing
2. In your sql statement you refer to cat but I cannot find a definition for what cat is, ie
DIM cat
cat = request.form("whatever") or something similar.
"FROM Products WHERE product_category='" & cat & "' " &_ Hope this helps
God i feel like a total muppet!
Basically the problem was here
<font color="#3366FF">
<b>Go To Page:</b>
<%
FOR i = i to ProdRS.PageCount
IF i <> cINT( pg ) THEN
%>
<a href="dvdhome.asp?cat=<%=prodRS( "product_category" )%>&pg=<%=i%>">
What i had done was put an 'i' instead of a '1'
Once again thanks for your help
*i'll go hang my head in shame"
Tom