Forums

ASP

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>
&lt;%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%&gt;
&lt;!--#include file="../Connections/connbabygoths.asp" --&gt;
&lt;!--#include file="../Connections/adojavas.inc" --&gt;
&lt;%
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;
%&gt;
&lt;!--DWLayoutTable--&gt;
&lt;tr&gt;
&lt;td height="382" colspan="2" valign="top"&gt;&lt;table width="100%"&gt;
&lt;tr&gt;
&lt;td colspan="2"&gt;&lt;p align="center"&gt;&lt;img src="black_cat_title.gif"&gt;
&lt;/td&gt;
&lt;/tr&gt;
<b>&lt;%
rs_products.Filter = "Product_code = BLACKCATNOD"
%&gt;</b>
&lt;tr&gt;
&lt;td colspan="2"&gt;&lt;div -- align="center"&gt;Item#&lt;%=(rs_products.Fields.Item("Product_code".Value)%&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
</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>
&lt;%
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

Reply to this topic