Forums

ASP

This topic is locked

recrodset issues

Posted 14 Jul 2005 18:12:10
1
has voted
14 Jul 2005 18:12:10 andy bertaut posted:
Hi again guys. Hope I explain this right.
on this site:
www.wizard.ie/asp/default.asp
i have set up a small nav menu on the left, with four buttons. Clicking Office Supplies opens the office-supplies page. this is a static page. from there i want to go to a dynamic page called category.asp. So far I am only workintg with the Pens & Pencils and Desktop Accessories links (until i sort this out!). Both are suppose to lick through to the category.asp page, generating a list of available items taken from the database (which contains a table for each category) My problem is this: both links (pens & pencils and desktops accs) are generating the same dynamic page. i was advised to add two recrodsets, one for each. I did, but same thing. On the category.asp page i added in the dynamic data from each recordset side by side, but still the same result. Now, all of the fields were showing, from BOTH tables. I believe i need to set up two things: a filter, and a Show If Recordset IS Empty(or Not empty) behaviour in order to make the category.asp page display only the relevant info from the relevant recrodset, and not both at the same time. If anyone can point me in the right direction, using pretty idiot-proof language as this is my first synamic site....!! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
category.asp needs to further link through to details.asp and there the same problem is occuring, but i am sure if i fix it for one i can fix it for both.
Thanks in advance...!

Replies

Replied 15 Jul 2005 14:02:00
15 Jul 2005 14:02:00 myke black replied:
First thing you need to do is response.write the SQL statement onto the page so you can see what the asp page is actually asking from the database, then you might be able to check whether the 'ID' variable that is passed in the querystring is being recognised or not.
Replied 15 Jul 2005 14:44:57
15 Jul 2005 14:44:57 Simon Bloodworth replied:
hi

can you post the code up please?

cheers

Simon

DWMX 2004 | ASP | VBScript
Replied 15 Jul 2005 17:40:48
15 Jul 2005 17:40:48 andy bertaut replied:
Thanks for the help guys...my brain is just about dead on this one. I really appreciate this, simon. i have been at it since i posted but hopefully the code is still intact as per my problem. I am so new to this stuff i just don't know where to start!

here is the code for office_supplies.asp..this is the page with the initial links. it is a static page and links to category.asp

&lt;%@LANGUAGE="JAVASCRIPT"%&gt;
&lt;!--#include file="../Connections/connWIZARD.asp" --&gt;
&lt;%
var rsP_P = Server.CreateObject("ADODB.Recordset";
rsP_P.ActiveConnection = MM_connWIZARD_STRING;
rsP_P.Source = "SELECT * FROM OS_pens_pencils";
rsP_P.CursorType = 0;
rsP_P.CursorLocation = 2;
rsP_P.LockType = 1;
rsP_P.Open();
var rsP_P_numRows = 0;
%&gt;
&lt;%
var rsD_A = Server.CreateObject("ADODB.Recordset";
rsD_A.ActiveConnection = MM_connWIZARD_STRING;
rsD_A.Source = "SELECT * FROM OS_desktop_acc";
rsD_A.CursorType = 0;
rsD_A.CursorLocation = 2;
rsD_A.LockType = 1;
rsD_A.Open();
var rsD_A_numRows = 0;
%&gt;
&lt;% var MM_paramName = ""; %&gt;
&lt;%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "" MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";

// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}

// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
}
}

// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length &gt; 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length &gt; 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length &gt; 0) MM_keepForm = MM_keepForm.substring(1);
%&gt;

this is the next page, the dynamic category.asp wo which the two links of the previous page link:

&lt;%@LANGUAGE="JAVASCRIPT"%&gt;
&lt;!--#include file="../Connections/connWIZARD.asp" --&gt;
&lt;%
var rsP_P = Server.CreateObject("ADODB.Recordset";
rsP_P.ActiveConnection = MM_connWIZARD_STRING;
rsP_P.Source = "SELECT * FROM OS_pens_pencils";
rsP_P.CursorType = 0;
rsP_P.CursorLocation = 2;
rsP_P.LockType = 1;
rsP_P.Open();
var rsP_P_numRows = 0;
%&gt;
&lt;%
var rsD_A = Server.CreateObject("ADODB.Recordset";
rsD_A.ActiveConnection = MM_connWIZARD_STRING;
rsD_A.Source = "SELECT * FROM OS_desktop_acc";
rsD_A.CursorType = 0;
rsD_A.CursorLocation = 2;
rsD_A.LockType = 1;
rsD_A.Open();
var rsD_A_numRows = 0;
%&gt;
&lt;%
var Repeat1__numRows = 2;
var Repeat1__index = 0;
rsP_P_numRows += Repeat1__numRows;
%&gt;
&lt;% var MM_paramName = ""; %&gt;
&lt;%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "" MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";

// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}

// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
}
}

// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length &gt; 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length &gt; 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length &gt; 0) MM_keepForm = MM_keepForm.substring(1);
%&gt;

Finally....the details.asp page to which the lists in category.asp link:
&lt;%@LANGUAGE="JAVASCRIPT"%&gt;
&lt;!--#include file="../Connections/connWIZARD.asp" --&gt;
&lt;%
var rsD_A = Server.CreateObject("ADODB.Recordset";
rsD_A.ActiveConnection = MM_connWIZARD_STRING;
rsD_A.Source = "SELECT * FROM OS_desktop_acc";
rsD_A.CursorType = 0;
rsD_A.CursorLocation = 2;
rsD_A.LockType = 1;
rsD_A.Open();
var rsD_A_numRows = 0;
%&gt;
&lt;%
var rsP_P = Server.CreateObject("ADODB.Recordset";
rsP_P.ActiveConnection = MM_connWIZARD_STRING;
rsP_P.Source = "SELECT * FROM OS_pens_pencils";
rsP_P.CursorType = 0;
rsP_P.CursorLocation = 2;
rsP_P.LockType = 1;
rsP_P.Open();
var rsP_P_numRows = 0;
%&gt;

Reply to this topic