Microsoft KB Archive/188714

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft OLE DB, versions 1.0, 2.0
 * Active Server Pages
 * ActiveX Data Objects (ADO)
 * Microsoft Active Server Pages
 * Microsoft Data Access Components version 2.5
 * Microsoft Internet Information Server version 4.0

-

SUMMARY
This article contains a sample that provides the same functionality you see when you use a browser that does not support Remote Data Services to access a Web site. The sample populates a multi-select list box with database records. After the user selects one or more records for filtering, the server returns only those records to the Web client.

Sample Code
  <%@ LANGUAGE="VBSCRIPT" %>

    Document Title   <%  Set cnnPubs = Server.CreateObject("ADODB.Connection") cnnPubs.Open "MyDSN", "MyUserName", "MyPassword"

Set cmdTemp = Server.CreateObject("ADODB.Command") Set cmdTemp.ActiveConnection = cnnPubs

Set rstAuthors = Server.CreateObject("ADODB.Recordset")

If Request.Form("Authors")="" Then ' Populate the listbox(es)%> <%  cmdTemp.CommandText = "SELECT au_id, au_lname, au_fname, phone FROM     authors" cmdTemp.CommandType = 1 Set rstAuthors = cmdTemp.Execute %>    <%     Do Until rstAuthors.EOF Response.Write("" &    rstAuthors(1) & ", " &  rstAuthors(2)) rstAuthors.MoveNext Loop rstAuthors.Close Set rstAuthors = Nothing %>     <%  Else ' Prepare to fetch selected authors If Request.Form("Authors").Count > 0 Then Response.Write "The following authors were selected:" strWhere="" For Each objSel in Request.Form("Authors") Set objParam = cmdTemp.CreateParameter(,129,1,11,objSel) cmdTemp.Parameters.Append objParam If strWhere="" Then strWhere="au_id=?" Else strWhere=strWhere & " OR au_id=? " End If     Next cmdTemp.CommandText = "SELECT au_id, au_lname, au_fname, phone FROM       authors WHERE " &  strWhere Set rstAuthors = cmdTemp.Execute

' Display selected records Response.Write(" ")

End If  End If   %> </BODY> </HTML> Additional query words: adovi adoengdb AXSFVBS

Keywords :

Version : WINDOWS:1.0,2.0,2.5; winnt:4.0; :

Platform : WINDOWS winnt

Issue type : kbhowto
 * }