Search.asp References RDS Control

The following <object> tag from the file DSearch.asp instantiates the RDS control that queries the FmLib database to create a table of search results:

<!-- DATA CONTROL -- Search Results -->
<object id="RDS_SearchResults" CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
        height=1 width=1 VIEWASTEXT>
</object>

Because DSearch.asp is part of the Library.asp file through an #include statement, the Library.asp page is the parent object, in the Document Object Model hierarchy, of the RDS control. Similarly, Library.asp is also the parent of the ifControl IFrame. (The code in which Library.asp creates the IFrame is shown at the beginning of this topic.)

Further, because Search.asp is called through this ifControl IFrame, it too has Library.asp as its parent. Because of this sibling relationship, Search.asp can communicate with the RDS control through their common parent.

There are many examples of this communication in the following code from Search.asp:

   If nRet = vbYes Then
      Set RDS = Parent.RDS_SearchResults
      If <%=optSearch%> = 1 Then     
          Parent.cbTitle.checked = true
      Elseif  <%=optSearch%> = 2 Then 
          Parent.cbAuthor.checked = true
      Else 
          Parent.cbSubject.checked = true
      End if
      
      Parent.SetCheckBoxes <%= cbAV%>,<%= cbBook%>, <%= cbPrd %> , <%= cbRef %>, <%= cbSoft %>
      Parent.ClearAllDivs()
      Parent.ShowSortBy(RDS.SortColumn)
      Parent.PleaseWait.style.display = ""
      Parent.txtWord.Value = "<%= strSearch%>"
      Parent.CurrentPage = 1
      
      ' Instruct RDS control to retrieve search results from table of results
      RDS.ExecuteOptions = adcExecAsync
      RDS.FetchOptions = adcFetchAsync
      RDS.Server = "http://<%= Request.ServerVariables("SERVER_NAME") %>"
      RDS.Connect = "<%= Application("FmLib_ConnectionString") %>"
      RDS.SQL = "SELECT * FROM <%= strTableName %> ORDER BY PubDate"
      RDS.Refresh
   End If

Early in the preceding code, the following line appears:

Set RDS = Parent.RDS_SearchResults

This code sets the RDS variable to represent the RDS control, which was named RDS_SearchResults when it was instantiated in Library.asp (technically, in the included file Dsearch.asp), and is done entirely for code clarity.

Next, a number of search options are set, including the connection to the FmLib database. The following setting uses an Application variable defined in global.asa:

RDS.Connect = "<%= Application("FmLib_ConnectionString") %>"

The next line defines the SQL query to be executed. In the following statement, strTableName identifies a table created to house the search results until the session times out:

RDS.SQL = "SELECT * FROM <%= strTableName %> ORDER BY PubDate"

Finally, the query is launched:

RDS.Refresh

Note  Most RDS queries can be performed asynchronously, which allows the client application to return control to the user sooner. However, if several RDS controls submit queries simultaneously, the results are often unpredictable. In that case, you will need to specify adcExecSync in the ExecuteOptions property. See Details.asp for an example of this.

For more RDS discussion, see Overview of RDS in the next section.