home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / rds.cab / addrbook.asp < prev    next >
Text File  |  1997-08-14  |  6KB  |  214 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Corporate Address Book</TITLE>
  4. </HEAD>
  5.  
  6. <!--
  7.     Purpose:    To provide a company directory search service for Web users.
  8.     Written By:    Microsoft Advanced Data Connector Team, Microsoft Corp.
  9.     Date:        April, 1997
  10. -->
  11.  
  12. <BODY BACKGROUND="Arcadia.gif">
  13. <tr>
  14.     <td align="center" width="40%">
  15.         <table border="2" cellpadding="7" cellspacing="7">
  16.             <tr>
  17.                 <td width="100%"><font color="#160B5A"><font
  18.                 size="4"><strong>Arcadia Bay Corporate Phone Directory</strong></font></font></td>
  19.             </tr>
  20.         </table>
  21.         </td>
  22. </tr>
  23.  
  24. <hr>
  25. <h2><font color = "#160B5A">Search Parameters</h2>
  26. <h5><font color = "#160B5A">Please enter one or more search patterns and press FIND to search.</h5>
  27.  
  28. <FONT COLOR = "#160B5A"><B>
  29.  
  30. <PRE> First Name     <INPUT NAME=SFirst SIZE=30> </PRE>
  31.  
  32. <PRE> Last Name      <INPUT NAME=SLast  SIZE=30> </PRE>
  33.  
  34. <PRE> Title          <INPUT NAME=STitle SIZE=30> </PRE>
  35.  
  36. <PRE> E-mail Alias   <INPUT NAME=SEmail SIZE=30> </PRE>
  37.  
  38. <!-- 
  39.     Command button options:
  40.     -----------------------
  41.     Find        Submit a search request to the database.
  42.     Clear        Clear the QBE fields (labor saving function only).
  43.     Update Profile    Send updated "address profile" back to the database.
  44.     Cancel Changes    Undo all changes since the last Update Profile.
  45. -->
  46.  
  47. <INPUT TYPE=BUTTON NAME="Find"         VALUE="Find">
  48. <INPUT TYPE=BUTTON NAME="Clear"     VALUE="Clear">
  49. <INPUT TYPE=BUTTON NAME="Update"     VALUE="Update Profile">
  50. <INPUT TYPE=BUTTON NAME="Cancel"     VALUE="Cancel Changes">
  51.  
  52. <hr>
  53. <h2><font color = "#400040">Search Results</h2>
  54. </B>
  55. <br>
  56.  
  57. <!-- 
  58.     This Sheridan DataGrid control (SGrid) are initialized to
  59.     allow changes to the data - these changes will be saved
  60.     to the database when the Update Profile button is pressed. 
  61. -->
  62.  
  63. <OBJECT CLASSID="clsid:BC496AE0-9B4E-11CE-A6D5-0000C0BE9395" 
  64.     ID=Grid1
  65.     CODEBASE="HTTP://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/Samples/ssdatb32.cab"  
  66.     HEIGHT= 125
  67.     Width = 495>
  68.     <PARAM NAME="AllowAddNew"   VALUE="TRUE">
  69.     <PARAM NAME="AllowDelete"   VALUE="TRUE">
  70.     <PARAM NAME="AllowUpdate"   VALUE="TRUE">
  71.     <PARAM NAME="BackColor"     VALUE="-2147483643">
  72.     <PARAM NAME="BackColorOdd"  VALUE="-2147483643">
  73.     <PARAM NAME="ForeColorEven" VALUE="0">
  74. </OBJECT>
  75. <br>
  76. <br>
  77. <INPUT TYPE=BUTTON NAME="First"     VALUE="First">
  78. <INPUT TYPE=BUTTON NAME="Prev"         VALUE="Previous">
  79. <INPUT TYPE=BUTTON NAME="Next"        VALUE="Next">
  80. <INPUT TYPE=BUTTON NAME="Last"        VALUE="Last">
  81. <hr>
  82.  
  83.  
  84. <!-- Non-visual controls - AdvancedDataControl -->
  85.  
  86. <OBJECT CLASSID="clsid:9381D8F2-0288-11d0-9501-00AA00B911A5"
  87.     ID="SControl"
  88.     CODEBASE="HTTP://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/msadc11.cab#version=1,1,0,0"  
  89.     WIDTH=1 HEIGHT=1>
  90.     <PARAM NAME="BINDINGS" VALUE="Grid1;">
  91.     <PARAM NAME="Connect" VALUE="DSN=ADCDEMO;UID=adcdemo;PWD=adcdemo;">
  92.     <PARAM NAME="Server" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
  93. </OBJECT>
  94.  
  95.  
  96. <!-- VBS scripting for composing queries, updating profiles, and retrieving search results. -->
  97.  
  98. <SCRIPT LANGUAGE="VBScript">
  99.  
  100. Dim myQuery
  101.  
  102. SUB Window_OnLoad
  103.     Grid1.CAPTION = "Arcadia Bay Corporate Phone Directory"
  104.  
  105.     'Initialize data grid with column names only.
  106.     SControl.SQL = "Select FirstName, LastName, Title, Email, Building, Room, Phone from Employee where 2 < 1"
  107.     SControl.Refresh
  108.  
  109. END SUB
  110.  
  111. 'Implement "Clear" button - clears all of the QBE fields in preparation for a new "Find."
  112.  
  113. SUB Clear_OnClick
  114.     SFirst.Value=""
  115.     SLast.Value=""
  116.     STitle.Value=""
  117.     SEmail.Value=""
  118. END SUB
  119.  
  120.  
  121. 'Implement "Find" button - composes a dynamic SQL query to be processed by the database and returns matching records to be bound to the SGrid object.
  122.  
  123. SUB Find_OnClick
  124.  
  125.     myQuery = "Select FirstName, LastName, Title, Email, Building, Room, Phone from Employee"
  126.  
  127.     'Check QBE fields and compose a dynamic SQL query.
  128.  
  129.     IF (SFirst.Value <> "") THEN
  130.         myQuery = myQuery + " where FirstName like '" + SFirst.Value + "%'"
  131.     END IF
  132.  
  133.     IF (SLast.Value <> "") THEN
  134.         myQuery = myQuery + " where LastName like '" + SLast.Value + "%'"
  135.     END IF
  136.  
  137.     IF (STitle.Value <> "") THEN
  138.         myQuery = myQuery + " where Title like '" + STitle.Value + "%'"
  139.     END IF
  140.  
  141.     IF (SEmail.Value <> "") THEN
  142.         myQuery = myQuery + " where Email like '" + SEmail.Value + "%'"
  143.     END IF
  144.  
  145.     'Set the new query and then refresh the SControl so that the new results are displayed.
  146.  
  147.     SControl.SQL = myQuery
  148.     SControl.Refresh
  149.  
  150.     'Optional command specific to the Sheridan Grid to ensure display of the correct data
  151.     Grid1.Rebind
  152.     
  153. END SUB
  154.  
  155. 'Navigation subroutines - based on currency changes to AdvancedDataControl (SControl).
  156.  
  157. 'Move to the first record in the bound recordset.
  158.  
  159. SUB First_OnClick
  160.       SControl.MoveFirst
  161. END SUB
  162.  
  163. 'Move to the next record from the current position in the bound recordset.
  164.  
  165. SUB Next_OnClick
  166.     On Error Resume Next
  167.     SControl.MoveNext
  168.     IF ERR.Number <> 0 THEN
  169.         SControl.Recordset.MoveLast  'If already at end of recordset stay at end.
  170.     END IF
  171. END SUB
  172.  
  173. 'Move to the previous record from the current position in the bound recordset.
  174.  
  175. SUB Prev_OnClick
  176.     On Error Resume Next
  177.     SControl.MovePrevious
  178.     IF ERR.Number <> 0 THEN
  179.         SControl.Recordset.MoveFirst  'If already at start of recordset stay at top.
  180.     END IF
  181. END SUB
  182.  
  183. 'Move to the last record in the bound recordset.
  184.  
  185. SUB Last_OnClick
  186.       SControl.MoveLast
  187. END SUB
  188.  
  189. 'Submits edits made and pull a clean copy of the new data.
  190.  
  191. SUB Update_OnClick
  192.       SControl.SubmitChanges
  193.     SControl.Refresh 
  194.  
  195.     'Optional command specific to the Sheridan Grid to ensure display of the correct data
  196.     Grid1.Rebind
  197. END SUB
  198.  
  199. 'Cancel edits and restores original values.
  200.  
  201. SUB Cancel_OnClick
  202.       SControl.CancelUpdate
  203.     SControl.Refresh
  204.  
  205.     'Optional command specific to the Sheridan Grid to ensure display of the correct data
  206.     Grid1.Rebind
  207. END SUB
  208.  
  209. </SCRIPT>
  210.  
  211. <BR>
  212. <font color = "#400040">This site powered by Microsoft Advanced Data Connector. </font>
  213. </BODY>
  214. </HTML>