working with two tables to produce one rs

Results 1 to 2 of 2

Thread: working with two tables to produce one rs

  1. #1
    Join Date
    Dec 1969

    Default working with two tables to produce one rs

    I&#039;m having trouble with a script. Here it is with as much explanation as to what I&#039;m trying to do as possible. If anyone could help me figure this out I would appreciate it.<BR><BR>In a nutshell, I&#039;m building a site for a radio station. I want to display the jock currently on the airs picture. The jocks schedule is kept in one table and the jocks info is stored in another table. Each jock has a unique id number and that is the common thread between each table. <BR><BR>&#039;Here I&#039;m trying to determine from the OnAir table what dj is currently on the air. This works. (when the full sql statement is intact)<BR><BR>Dim WhosOn<BR>WhosOn = "SELECT * FROM OnAir WHERE (omitted long sql statement)"<BR><BR>Dim WhosOnRS<BR>Set WhosOnRS = Conn1.Execute(WhosOn)<BR><BR>&#039;From the above, I should have one record returned. I now want to take the jockid field from this record and match it with the jockid field from another table. <BR><BR>Dim JID<BR>JID = "Select * FROM Jocks WHERE jockid = WhosOnRS(" & jockid & ")"<BR><BR>Dim OnAirRS<BR>Set OnAirRS = Conn1.Execute(JID)<BR><BR>&#039;Now I want to display the information from the Jocks table.<BR><BR>While Not OnAirRS.EOF<BR>%&#062;<BR><BR>&#060;table&#062;&#0 60;tr&#062;&#060;td&#062;&#060;img src="&#060;%=OnAirRS("small_pic_url")%&#062;"&#062 ;&#060;/td&#062;&#060;/tr&#062;&#060;/table&#062;<BR><BR>&#060;%<BR>OnAirRS.MoveNext<BR> WEND<BR>OnAirRS.close<BR>set OnAirRS=nothing<BR>closedb1<BR>%&#062;<BR><BR>I hope this is making sense to someone. I get the error: "Undefined function &#039;WhosOnRS&#039; in expression". I&#039;ve been searching for two hours trying to find an answer. Thanks in advance for your help!

  2. #2
    Join Date
    Dec 1969

    Default RE: working with two tables to produce one rs

    Try:<BR>JID = "Select * FROM Jocks WHERE jockid = "WhosOnRS(" & jockid & ")""<BR><BR>Just a couple added quotes! :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts