home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / treevwx / tvx3demo.exe / data.1 / TV3RDS.ASP < prev    next >
Encoding:
Text File  |  1998-08-18  |  10.5 KB  |  342 lines

  1. <html>
  2.  
  3. <head>
  4. <title>RDS 1.5 Query Page</title>
  5. </head>
  6.  
  7. <body BACKGROUND="AddressBook/Arcadia.gif">
  8.  
  9. <h1 align="center">Remote Data Service 1.5 Query Page</h1>
  10.  
  11. <p align="center"> ProtoView TreeViewX v3.0</p>
  12.  
  13. <p align="center"><br>
  14. <OBJECT classid=CLSID:DB625B9A-05EA-11D2-97DD-00400520799C height=180
  15. id=PVTreeViewX1 style="LEFT: 0px; TOP: 0px" width=200 VIEWASTEXT>
  16.     <PARAM NAME="_Version" VALUE="196608">
  17.     <PARAM NAME="_ExtentX" VALUE="5292">
  18.     <PARAM NAME="_ExtentY" VALUE="4762">
  19.     <PARAM NAME="_StockProps" VALUE="237">
  20.     <PARAM NAME="ForeColor" VALUE="0">
  21.     <PARAM NAME="BackColor" VALUE="16777215">
  22.     <PARAM NAME="BorderStyle" VALUE="0">
  23.     <PARAM NAME="Enabled" VALUE="-1">
  24.     <PARAM NAME="Appearance" VALUE="1">
  25.     <PARAM NAME="SelectMode" VALUE="0">
  26.     <PARAM NAME="HorizontalExtent" VALUE="0">
  27.     <PARAM NAME="MultiColumnStyle" VALUE="0">
  28.     <PARAM NAME="ColumnWidth" VALUE="100">
  29.     <PARAM NAME="NumberOfColumns" VALUE="3">
  30.     <PARAM NAME="Indent" VALUE="18">
  31.     <PARAM NAME="StandardDefaultPicture" VALUE="0">
  32.     <PARAM NAME="Sort" VALUE="0">
  33.     <PARAM NAME="UseTabStops" VALUE="0">
  34.     <PARAM NAME="IntegralHeight" VALUE="-1">
  35.     <PARAM NAME="MultiColumn" VALUE="0">
  36.     <PARAM NAME="EnableMicroBitmaps" VALUE="-1">
  37.     <PARAM NAME="EnableBitmaps" VALUE="-1">
  38.     <PARAM NAME="EnableLines" VALUE="-1">
  39.     <PARAM NAME="AutoOpen" VALUE="0">
  40.     <PARAM NAME="ProportionalScrollBars" VALUE="-1">
  41.     <PARAM NAME="AlwaysShowSelection" VALUE="-1">
  42.     <PARAM NAME="UseStateBitmaps" VALUE="-1">
  43.     <PARAM NAME="AllowInPlaceEditing" VALUE="-1">
  44.     <PARAM NAME="EnableToolTips" VALUE="-1">
  45.     <PARAM NAME="ToolTipBackColor" VALUE="12648447">
  46.     <PARAM NAME="SelectedTextBackColor" VALUE="-2147483635">
  47.     <PARAM NAME="SelectedTextForeColor" VALUE="-2147483634">
  48.     <PARAM NAME="LineColor" VALUE="-2130771968">
  49.     <PARAM NAME="DataMember" VALUE="">
  50.     <PARAM NAME="StandardLevelPicture0" VALUE="-1">
  51.     <PARAM NAME="StandardLevelPicture1" VALUE="-1">
  52.     <PARAM NAME="StandardLevelPicture2" VALUE="-1">
  53.     <PARAM NAME="StandardLevelPicture3" VALUE="-1">
  54.     <PARAM NAME="StandardLevelPicture4" VALUE="-1">
  55.     <PARAM NAME="StandardLevelPicture5" VALUE="-1">
  56.     <PARAM NAME="StandardLevelPicture6" VALUE="-1">
  57.     <PARAM NAME="StandardLevelPicture7" VALUE="-1">
  58.     <PARAM NAME="StandardLevelPicture8" VALUE="-1">
  59.     <PARAM NAME="StandardLevelPicture9" VALUE="-1">
  60.     <PARAM NAME="StandardLevelPicture10" VALUE="-1">
  61.     <PARAM NAME="StandardLevelPicture11" VALUE="-1">
  62.     <PARAM NAME="StandardLevelPicture12" VALUE="-1">
  63.     <PARAM NAME="StandardLevelPicture13" VALUE="-1">
  64.     <PARAM NAME="StandardLevelPicture14" VALUE="-1">
  65.     <PARAM NAME="StandardLevelPicture15" VALUE="-1">
  66.     <PARAM NAME="StandardLevelPicture16" VALUE="-1">
  67.     <PARAM NAME="StandardLevelPicture17" VALUE="-1">
  68.     <PARAM NAME="StandardLevelPicture18" VALUE="-1">
  69.     <PARAM NAME="StandardLevelPicture19" VALUE="-1">
  70.     <PARAM NAME="DataField0" VALUE="ProductName">
  71.     <PARAM NAME="DataField1" VALUE="">
  72.     <PARAM NAME="DataField2" VALUE="">
  73.     <PARAM NAME="DataField3" VALUE="">
  74.     <PARAM NAME="DataField4" VALUE="">
  75.     <PARAM NAME="DataField5" VALUE="">
  76.     <PARAM NAME="DataField6" VALUE="">
  77.     <PARAM NAME="DataField7" VALUE="">
  78.     <PARAM NAME="DataField8" VALUE="">
  79.     <PARAM NAME="DataField9" VALUE="">
  80.     <PARAM NAME="DataField10" VALUE="">
  81.     <PARAM NAME="DataField11" VALUE="">
  82.     <PARAM NAME="DataField12" VALUE="">
  83.     <PARAM NAME="DataField13" VALUE="">
  84.     <PARAM NAME="DataField14" VALUE="">
  85.     <PARAM NAME="DataField15" VALUE="">
  86.     <PARAM NAME="DataField16" VALUE="">
  87.     <PARAM NAME="DataField17" VALUE="">
  88.     <PARAM NAME="DataField18" VALUE="">
  89.     <PARAM NAME="DataField19" VALUE="">
  90.  
  91.     <PARAM NAME="DataSource" DATASRC="#ADC">
  92. </OBJECT>
  93.  
  94. </p>
  95. <div align="center"><center>
  96.  
  97. <table>
  98.   <tr>
  99.     <td>ADC Server:</td>
  100.     <td><input SIZE="70" NAME="Server"> </td>
  101.   </tr>
  102.   <tr>
  103.     <td>Connection:</td>
  104.     <td><input SIZE="70" NAME="Connect"> </td>
  105.   </tr>
  106.   <tr>
  107.     <td>Query:</td>
  108.     <td><input SIZE="70" NAME="SQL"> </td>
  109.   </tr>
  110.   <tr>
  111.     <td>Recordset Status:</td>
  112.     <td><input SIZE="30" NAME="RecordSetStat" > </td>
  113.   </tr>
  114.   <tr>
  115.     <td>Execute Option:</td>
  116.     <td><input SIZE="30" NAME="ExecOpt" >  </td>
  117.   </tr>
  118. </table>
  119. </center></div>
  120.  
  121. <p align="center"><br>
  122. <input TYPE="button" VALUE="Run!" NAME="Requery">
  123. <input TYPE="button" VALUE="First" NAME="MoveFirst">
  124. <input TYPE="button" VALUE="Prev" NAME="MovePrev">
  125. <input TYPE="button" VALUE="Next" NAME="MoveNext">
  126. <input TYPE="button" VALUE="Last" NAME="MoveLast">
  127. <br>
  128. <br>
  129. <input TYPE="button" VALUE="Save Changes" NAME="Update">
  130. <input TYPE="button" VALUE ="Cancel Changes" NAME="Cancel">
  131. <br>
  132. <br>
  133. <input TYPE="button" VALUE="Cancel Query" NAME="Stop">
  134. <input TYPE="button" VALUE  ="Turn Asynch off" NAME="Asynchoff">
  135. <input TYPE="button" VALUE="Turn Asynch on" NAME="Asynchon">
  136.  
  137. <OBJECT classid=CLSID:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=ADC
  138. width=1></OBJECT>
  139.  
  140. <script LANGUAGE="VBScript">
  141. '---- enum Values ----
  142. Const adcExecSync = 1
  143. Const adcExecAsync = 2
  144.  
  145. '---- enum Values ----
  146. Const adcFetchUpFront = 1
  147. Const adcFetchBackground = 2
  148. Const adcFetchAsync = 3
  149.  
  150. '---- enum Values ----
  151. Const adcStateClosed = &H00000000
  152. Const adcStateOpen = &H00000001
  153. Const adcStateConnecting = &H00000002
  154. Const adcStateExecuting = &H00000004
  155. Const adcStateFetching = &H00000008
  156.  
  157. '---- enum Values ----
  158. Const adcReadyStateUninitialized = 0
  159. Const adcReadyStateLoading = 1
  160. Const adcReadyStateLoaded = 2
  161. Const adcReadyStateInteractive = 3
  162. Const adcReadyStateComplete = 4
  163.  
  164.  
  165. SUB Window_OnLoad
  166.   Server.Value = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
  167.   Connect.Value = "DSN=AdvWorks"
  168.   SQL.Value = "Select * from Products"
  169.  
  170.   Select case ADC.ExecuteOptions
  171.     case adcExecSync: ExecOpt.Value = "Synchronous"
  172.     case adcExecAsync: ExecOpt.Value = "Asynchronous"
  173.   END Select
  174.  
  175.   Select case ADC.ReadyState
  176.     case adcReadyStateUninitialized: RecordSetStat.Value = "Unitialized"
  177.     case adcReadyStateLoading: RecordSetStat.Value = "Loading"
  178.     case adcReadyStateLoaded: RecordSetStat.Value = "Loaded"
  179.     case adcReadyStateInteractive: RecordSetStat.Value = "Interactive"
  180.     case adcReadyStateComplete: RecordSetStat.Value = "Complete"
  181.   END Select
  182.  
  183. END SUB
  184.  
  185.  
  186. SUB ADC_OnDataSetChanged
  187.   'Fires after execution is done
  188.  
  189.   Select case ADC.ReadyState
  190.     case adcReadyStateUninitialized: RecordSetStat.Value = "Unitialized"
  191.     case adcReadyStateLoading: RecordSetStat.Value = "Loading"
  192.     case adcReadyStateLoaded: RecordSetStat.Value = "Loaded"
  193.     case adcReadyStateInteractive: RecordSetStat.Value = "Interactive"
  194.     case adcReadyStateComplete: RecordSetStat.Value = "Complete"
  195.   END Select
  196.  
  197. END SUB
  198.  
  199. SUB ADC_OnDataSetComplete
  200.  'Fires after fetching is complete
  201.  
  202.  Select case ADC.ReadyState
  203.    case adcReadyStateUninitialized: RecordSetStat.Value = "Unitialized"
  204.    case adcReadyStateLoading: RecordSetStat.Value = "Loading"
  205.    case adcReadyStateLoaded: RecordSetStat.Value = "Loaded"
  206.    case adcReadyStateInteractive: RecordSetStat.Value = "Interactive"
  207.    case adcReadyStateComplete: RecordSetStat.Value = "Complete"
  208.  END Select
  209.  
  210. END SUB
  211.  
  212. sub Move (strDirection)
  213.   'Custom sub to handle Asyncronous fetching
  214.   'Asynchronous fetching allows you to cancel in the middle of fetching a large
  215.   'recordset
  216.   if ADC.Recordset.State = adcStateClosed then
  217.     if ADC.ReadyState = adcReadyStateComplete then
  218.       msgbox "Query results failed to arrive, please rerun query synchronously and check for errors."
  219.     end if
  220.     if ADC.ReadyState = adcReadyStateLoaded then
  221.       msgbox "Query results have not yet arrived"
  222.     end if
  223.   else
  224.     if ADC.Recordset.State = adcStateOpen Then
  225.       on error resume next
  226.       select case strDirection
  227.     Case "First"
  228.       ADC.Recordset.MoveFirst
  229.     Case "Next"
  230.       ADC.Recordset.MoveNext
  231.     Case "Last"
  232.       ADC.Recordset.MoveLast
  233.     Case "Prev"
  234.       ADC.Recordset.MovePrevious
  235.        end select
  236.       IF ERR.Number <> 0 then
  237.     if Err.Number = 3021 THEN
  238.       if ADC.Recordset.BOF then
  239.         ADC.Recordset.MoveFirst  'If already at start of recordset stay at top.
  240.       else
  241.         ADC.Recordset.MoveLast   'If already at end of recordset stay at bottom.
  242.       END IF
  243.     else
  244.       msgbox "Unexpected error in Move actions. " & Err.Description
  245.     END IF
  246.       end if
  247.     else
  248.       msgbox "The state is unexpected, an error has occurred"   'Very General error msg.
  249.     end if
  250.   end if
  251. End Sub
  252.  
  253. SUB MoveFirst_OnClick
  254.   'Call to Custom Sub, Move, to handle attempts to move the record pointer during asynch fetches
  255.   move "First"
  256. END SUB
  257.  
  258. SUB MoveNext_OnClick
  259.   'Call to Custom Sub, Move, to handle attempts to move the record pointer during asynch fetches
  260.   Move "Next"
  261. END SUB
  262.  
  263. SUB MovePrev_OnClick
  264.   'Call to Custom Sub, Move, to handle attempts to move the record pointer during asynch fetches
  265.   Move "Prev"
  266. END SUB
  267.  
  268. SUB MoveLast_OnClick
  269.   'Call to Custom Sub, Move, to handle attempts to move the record pointer during asynch fetches
  270.   Move "Last"
  271. END SUB
  272.  
  273. 'Submits edits made and pulls a clean copy of the new data.
  274. SUB Update_OnClick
  275.   If ADC.ReadyState <> adcReadyStateLoaded then
  276.     ADC.SubmitChanges
  277.     ADC.Refresh
  278.   Else
  279.     MsgBox "Query results still arriving, Please wait"
  280.   End if
  281.  
  282. END SUB
  283.  
  284. 'Cancel edits and restores original values.
  285. SUB Cancel_OnClick
  286.   if ADC.ReadyState <> adcReadyStateLoaded then
  287.      ADC.CancelUpdate
  288.   Else
  289.     MsgBox "Query results still arriving, Please wait"
  290.   End if
  291.  
  292. END SUB
  293.  
  294. SUB Requery_OnClick
  295.   If ADC.ReadyState <> adcReadyStateComplete then
  296.     MsgBox "Query results still arriving, Please wait"
  297.   Else
  298.     ADC.Server = Server.Value
  299.      ADC.Connect = Connect.Value
  300.     ADC.SQL = SQL.Value
  301.  
  302.     ADC.Refresh
  303.   End if
  304.  
  305. END SUB
  306.  
  307. SUB Stop_OnClick
  308.   'If an asychronous query is taking too long to execute you can use this to cancel the query
  309.   ADC.Cancel
  310.  
  311. END SUB
  312.  
  313. SUB Asynchoff_OnClick
  314.   'In cases where there are problems querying the database you may need to switch to synchronous mode
  315.   'in order to get the error
  316.   ADC.ExecuteOptions = adcExecSync
  317.   ADC.FetchOptions = adcFetchBackground
  318.   Select case ADC.ExecuteOptions
  319.     case adcExecSync: ExecOpt.Value = "Synchronous"
  320.     case adcExecAsync: ExecOpt.Value = "Asynchronous"
  321.   END Select
  322.  
  323.  
  324. END SUB
  325.  
  326. SUB Asynchon_OnClick
  327.   'In cases where there are problems querying the database you may need to switch to synchronous mode
  328.   'in order to get the error
  329.   ADC.ExecuteOptions = adcExecAsync
  330.   ADC.FetchOptions = adcFetchAsync
  331.   Select case ADC.ExecuteOptions
  332.     case adcExecSync: ExecOpt.Value = "Synchronous"
  333.     case adcExecAsync: ExecOpt.Value = "Asynchronous"
  334.   END Select
  335.  
  336. END SUB
  337.  
  338. </script>
  339.  </p>
  340. </body>
  341. </html>
  342.