Forums
This topic is locked
Recordset filter problem
Posted 03 Jan 2004 03:50:23
1
has voted
03 Jan 2004 03:50:23 Emmanuel Frenehard posted:
Hello All,This is my first post on DMXZone as I always found answers from reading other people's posts. This time it is my turn to ask for help.
Basically, I have an ASP page with a recordset (rs_products) that queries a view of product references in an MS Access database.
The query returns two distinct products (I have a where clause in the SQL) but I need to put a filter since I want to display dynamic fields for the two products in different HTML tables.
Below is an extract of my page
<pre id=code><font face=courier size=2 id=code>
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/connbabygoths.asp" -->
<!--#include file="../Connections/adojavas.inc" -->
<%
var rs_products = Server.CreateObject("ADODB.Recordset"
rs_products.ActiveConnection = MM_connbabygoths_STRING;
rs_products.Source = "SELECT * FROM product_v WHERE Product_code = 'BLACKCATNOD' OR product_code = 'RAVENNOD'";
rs_products.CursorType = 0;
rs_products.CursorLocation = 2;
rs_products.LockType = 1;
rs_products.Open();
var rs_products_numRows = 0;
%>
<!--DWLayoutTable-->
<tr>
<td height="382" colspan="2" valign="top"><table width="100%">
<tr>
<td colspan="2"><p align="center"><img src="black_cat_title.gif">
</td>
</tr>
<b><%
rs_products.Filter = "Product_code = BLACKCATNOD"
%></b>
<tr>
<td colspan="2"><div -- align="center">Item#<%=(rs_products.Fields.Item("Product_code".Value)%></div></td>
</tr>
</font id=code></pre id=code>
When I preview this code in IE, I get the following error message:
<pre id=code><font face=courier size=2 id=code>
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/toys_nodder/toys_nodder.asp, line 87
</font id=code></pre id=code>
Line 87 is where I have positionned the recordset filter.
I am not very familiar with ASP and mainly use Dreamweaver to write the code for me.
Thanks for your help
Emmanuel
Edited by - efrenehard on 03 Jan 2004 04:11:40
Edited by - efrenehard on 03 Jan 2004 19:42:59
Replies
Replied 03 Jan 2004 20:20:09
03 Jan 2004 20:20:09 Emmanuel Frenehard replied:
In fact, my problem was with the syntax of my recordset filter: I was missing the obvious' between each recordset parameter. It should have been
<pre id=code><font face=courier size=2 id=code>
<%
rs_products.Filter = "Product_code = 'BLACKCATNOD'" with ' at the start and end of the filter parameter.
</font id=code></pre id=code>
Consider this a closed problem.
Emmanuel
<pre id=code><font face=courier size=2 id=code>
<%
rs_products.Filter = "Product_code = 'BLACKCATNOD'" with ' at the start and end of the filter parameter.
</font id=code></pre id=code>
Consider this a closed problem.
Emmanuel