<%@ Language=VBScript %> <% Option Explicit %> <% Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.Provider = "MSDataShape" objConn.Open "DSN=University" Dim objClassRS, objProfessorRS Set objClassRS = Server.CreateObject("ADODB.Recordset") Dim strShapeSQL strShapeSQL = "SHAPE {SELECT ClassName, RefNumber, ProfessorID FROM Class} " & _ "APPEND({SELECT ProfessorID, " & _ "FirstName, LastName, PhoneNumber FROM Professor} AS Prof " & _ "RELATE ProfessorID TO ProfessorID)" objClassRS.Open strShapeSQL, objConn Do While Not objClassRS.EOF Response.Write "<BR>" & objClassRS("ClassName") & "(" & _ objClassRS("RefNumber") & ")<BR>" Set objProfessorRS = objClassRS("Prof").Value Do While Not objProfessorRS.EOF Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;" & _ objProfessorRS("FirstName") & " " & _ objProfessorRS("LastName") & " (Phone: " & _ objProfessorRS("PhoneNumber") & ")<BR>" objProfessorRS.MoveNext Loop objClassRS.MoveNext Loop objClassRS.Close Response.Write "<P><HR><P>" strShapeSQL = "SHAPE {SELECT ProfessorID, FirstName, LastName, PhoneNumber " & _ " FROM Professor}" & _ " APPEND({SELECT ClassName, RefNumber, ProfessorID FROM Class} AS Class " & _ " RELATE ProfessorID TO ProfessorID)" Set objProfessorRS = Server.CreateObject("ADODB.Recordset") objProfessorRS.Open strShapeSQL, objConn Do While Not objProfessorRS.EOF Response.Write "<BR>" Response.Write objProfessorRS("FirstName") & " " Response.Write objProfessorRS("LastName") & _ " (Phone: " & objProfessorRS("PhoneNumber") & ")<BR>" Set objClassRS = objProfessorRS("Class").Value Do While Not objClassRS.EOF Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;" & _ objClassRS("ClassName") & _ " (" & objClassRS("RefNumber") & ")<BR>" objClassRS.MoveNext Loop objProfessorRS.MoveNext Loop objProfessorRS.Close Set objProfessorRS = Nothing Set objClassRS = Nothing objConn.Close Set objConn = Nothing %>