Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Dynamic Repeat Region Table

Hi,

I have 2 recordsets Recordset1 & Recordset2

I am wanting to create a repeat region of the Recordset1 but also have a colum that is linked to Recordset2

Recordset1 is transaction details based on url=MemberID
Recordset2 is member details based on the column MemberID in Recordset1

when i try to do this, i get the first record in the database for Recordset2 column on all the listing in the table.

Can I make Recordset2 dependent on Value of Row for Recordset1?

Austin
0
USCBigRed
Asked:
USCBigRed
  • 6
  • 5
1 Solution
 
Jason C. LevineNo oneCommented:
Hi Austin,

What you need to do is create ONE recordset that pulls in the relevant fields from both tables via a SQL Join for the repeat region or have the second recordset be on a different page and call it via a master/detail link.
0
 
USCBigRedAuthor Commented:
when, i join, it returns more rows than i want, i think it returns everything in the database.
0
 
Jason C. LevineNo oneCommented:
It's a little hard to help you write SQL without seeing at least the table structures in question...
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
USCBigRedAuthor Commented:
sorry about that, here you go...
can you figure it out from this...

<%
Dim Recordset1ALL
Dim Recordset1ALL_numRows

Set Recordset1ALL = Server.CreateObject("ADODB.Recordset")
Recordset1ALL.ActiveConnection = MM_inah_SQL_STRING
Recordset1ALL.Source = "SELECT *  FROM dbo.inah_member, dbo.inah_referral  WHERE referralbyMemberID = " + Replace(Recordset1ALL__MMColParam, "'", "''") + ""
Recordset1ALL.CursorType = 0
Recordset1ALL.CursorLocation = 2
Recordset1ALL.LockType = 1
Recordset1ALL.Open()

Recordset1ALL_numRows = 0
%>

do i need to make the SELECT Statement do something else?
0
 
Jason C. LevineNo oneCommented:
Yes, most likely.  When you have two tables with related records, you need to structure the SQL with an INNER JOIN so that the related records are pulled up as part of the same recordset.  So let us say hypothetically you have a users table and a user_detail table where user_id is the linking field.  The correct SQL to pull everything up is:

SELECT users.field1, users.field2, users.field3, user_detail.field4, user_detail.field5, user_detail.field6
FROM users INNER JOIN user_detail ON users.user_id = user_detail.user_id;
0
 
USCBigRedAuthor Commented:
Thanks so much!!
0
 
Jason C. LevineNo oneCommented:
No problem.
0
 
USCBigRedAuthor Commented:
hey, i've posted another question, check it out!!
Austin
0
 
Jason C. LevineNo oneCommented:
Where?
0
 
USCBigRedAuthor Commented:
0
 
USCBigRedAuthor Commented:
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now