Simple SQL Search Results

<%' !--#INCLUDE VIRTUAL="/iissamples/issamples/ADOVBS.INC"--%> <% QueryForm = "/iissamples/issamples/sqlqhit.htm" Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionString = "provider=msidxs;" Conn.Open Set AdoCommand = Server.CreateObject("ADODB.Command") set AdoCommand.ActiveConnection = Conn %> Executing the following query: <% if Request.QueryString("CiRestriction")="" then %> <% if Request.QueryString("CiOrderBy")="" then %> <% AdoCommand.CommandText = "Select "&Request.QueryString("CiColumns")&" from " &Request.QueryString("CiScope") %> <% else %> <% AdoCommand.CommandText = "Select "&Request.QueryString("CiColumns")&" FROM " &Request.QueryString("CiScope")&" ORDER BY " &Request.QueryString("CiOrderBy") %> <% end if %> <% else %> <% if Request.QueryString("CiOrderBy")="" then %> <% AdoCommand.CommandText = "Select "&Request.QueryString("CiColumns")&" from " &Request.QueryString("CiScope")&" where "&Request.QueryString("CiRestriction") %> <% else %> <% AdoCommand.CommandText = "Select "&Request.QueryString("CiColumns")&" FROM " &Request.QueryString("CiScope")&" WHERE "&Request.QueryString("CiRestriction")&" ORDER BY " &Request.QueryString("CiOrderBy") %> <% end if %> <% end if%>

<%=AdoCommand.CommandText%> <% Set RS = Server.CreateObject("ADODB.RecordSet") AdoCommand.Properties("Bookmarkable") = True RS.CursorType = adOpenKeyset RS.MaxRecords = 300 RS.open AdoCommand CiSearchString = CStr(RS.Properties("Query Restriction")) %>

<% For i = 0 to RS.Fields.Count - 1 %> <% Next %> <% Do While Not RS.EOF %> <% For i = 0 to RS.Fields.Count - 1 %> <%if RS(i).Name = "PATH" or RS(i).Name="VPATH" then %> <%if RS(i).Name="VPATH" and CiSearchString <> "" then %> <% ' Construct the URL for hit highlighting WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") ) WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( CiSearchString ) WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "" ) WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "" ) WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm ' WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID %> <%end if%> <%else%> <%end if%> <% Next %> <% RS.MoveNext Loop RS.Close Conn.Close %>
<% = RS(i).Name %>
<% = RS(i) %>
Hit Highlighting:
Highlight matching terms in document using Summary mode. Summary
Highlight matching terms in document. Full
<%else%>
<% = RS(i) %><% = RS(i) %>