Forums

ASP

This topic is locked

Linking recordsetts....

Posted 17 Apr 2003 12:25:18
1
has voted
17 Apr 2003 12:25:18 rob mason posted:
I have a detail page that gives a dynamic list of applications from a SQL database.....

<%=(rsAppsList.Fields.Item("Application_Name".Value)%>

I then need to return the application status - information that is held in a different database and therefore recordset.....

<%=(rsApps.Fields.Item("ApplicationStatusID".Value)%>

think link is the applicationName/ID

How do I get rsApps to return values where ApplicationID is = to rsAppsLIst.ApplicationName

?

Thanks in advance!

R

Replies

Replied 17 Apr 2003 18:43:23
17 Apr 2003 18:43:23 Dan Berdusco replied:
This is kind of a round about way of doing it but you can try this. Try setting a session variable equal to rsAppsLIst.ApplicationName like this:

<pre id=code><font face=courier size=2 id=code>&lt;%session("AppID"=(rsAppsLIst.Fields.Item("ApplicationName".Value)%&gt; </font id=code></pre id=code>

And then have rsApps return values where applicationID = session variable(AppID)

Hope this can help you.
Replied 22 Apr 2003 15:45:49
22 Apr 2003 15:45:49 Vince Baker replied:
Ideally you would link it in the sql but if you do not know how to use the following method:

Create your first recordset to get the ID that you will use to filter the second database with.

When you have this, create a second recordset like the following:

Select *
from yourtablename
where AppIDField = strID

Now, in the advanced recordset option add the variable strID with a default value of whatever you like. In the Runtime value enter the following:

YourFirstRecordsetName.fields.item("AppIDField".value

This will filter the second recordset by the results from the first.

Make sure you create the recordsets in this order.

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Reply to this topic