Forums

This topic is locked

Dreamweaver CS3 standard recordset paging headache

Posted 15 Jan 2008 09:26:14
1
has voted
15 Jan 2008 09:26:14 conor wall posted:
Hi,

I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my results page.

- Recordset Paging works if no parameters are used in the recordset sql code (ie. simple sql code):

SELECT *
FROM db_name
WHERE (db_field1 LIKE ‘%text1%’ OR db_field2 LIKE ‘%text2%’


- Recordset Paging works if I pass the same text to the sql code using parameters set within the recordset:

SELECT *
FROM db_name
WHERE (db_field1 LIKE %parameter1% OR db_field2 LIKE %parameter2%)

- inside the recordset parameter1 was set to ‘text1’, parameter2 was set to ‘text2


- However if I pass the same text (text1, text2) from a FORM on a search page to the recordset using recordset parameters, the Recordset Paging fails.

SELECT *
FROM db_name
WHERE (db_field1 LIKE %parameter1% OR db_field2 LIKE %parameter2%)

- inside the recordset parameter1 and parameter2 were set using the Request.Form("…."
- on the FORM the values of the fields were set to text1, text2


The form, database, sql code all work fine. After I perform a search, the correct database results are displayed on my first results.asp page. My problem is when I try to use recordset paging. For some reason when I try to page through the results I get the following error:

--

Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

--

I have completely striped my code to the bare essentials, and conclude that the search criteria are not being sent to the results page each time I click “Next” etc. Therefore each time I try to page through the results, the recordset values are all empty and the EOF value is returned.

--

The URL passed by clicking the “Next” link

localhost/conor%20wall%20photography/pages/results.asp?SearchValue1=city&SearchValue2=country&submit=Submit&index=1

It seems to pass the search criteria, but maybe it isn’t being passed correctly.

--

Has anyone else also encountered this problem? If so what did you do? Any help, advice, suggestions or other scripts (javascript or vbscript) that will work instead will be gratefully accepted. I have been trying to fix this for days and it’s driving me crazy.

Thanks,

Conor

Replies

Replied 16 Jan 2008 10:38:04
16 Jan 2008 10:38:04 conor wall replied:
Hi,

Following the suggestion of a member of a different forum, I have fixed the code error.

The code which gets the search values from the FORM on the search page, must be changed so that it also gets the search values passed in the URL query string. Only one of these occurrences will ever happen. The first time the results.asp page is displayed it will use the search values pulled from the FORM. All other times the results.asp page is displayed (because of recordset paging - Next, Previous … it will use the same search values, but this time pulled from the URL.

Therefore the code:

<pre id=code><font face=courier size=2 id=code>
&lt;%
Dim rs__SearchValue1
rs__SearchValue1 = "NULL"
' Get search criteria from FORM on the search page (FORM has 2 fields - SearchValue1 and SearchValue2)
If (Request.Form("SearchValue1" &lt;&gt; "" Then
rs__SearchValue1 = Request.Form("SearchValue1"
End If
%&gt;
</font id=code></pre id=code>

Must be changed to:

<pre id=code><font face=courier size=2 id=code>
&lt;%
Dim rs__SearchValue1
rs__SearchValue1 = "NULL"

' Get search criteria from FORM on the search page (FORM has 2 fields - SearchValue1 and SearchValue2)
If (Request.Form("SearchValue1" &lt;&gt; "" Then
rs__SearchValue1 = Request.Form("SearchValue1"

' If the FORM field is empty, then look in the URL query string for the old FORM field value
Elseif (Request.QueryString("SearchValue1" &lt;&gt; "" Then
rs__SearchValue1 = Request.QueryString("SearchValue1"
End If
%&gt;
</font id=code></pre id=code>

I will also email Dreamweaver to tell them to update their standard record paging behavior code.
Thanks to all who replied with help.

Conor

Reply to this topic