Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.6 KiB

  1. <%@ LANGUAGE = PerlScript%>
  2. <html>
  3. <head>
  4. <meta name="GENERATOR" content="ActiveState_Hack = Dick Hardt">
  5. <!--
  6. Copyright (c) 1996, Microsoft Corporation. All rights reserved.
  7. Developed by ActiveState Internet Corp., http://www.ActiveState.com
  8. -->
  9. <title>ActiveX Database Objects</title>
  10. </head>
  11. <body>
  12. <BODY BGCOLOR=#FFFFFF>
  13. <!--
  14. ActiveState PerlScript sample
  15. PerlScript: The coolest way to program custom web solutions.
  16. -->
  17. <!-- Masthead -->
  18. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  19. <TR VALIGN=TOP ><TD WIDTH=400>
  20. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
  21. </TD></TR></TABLE>
  22. <HR>
  23. <H3>ActiveX Data Objects (ADO)</H3>
  24. <%
  25. # Create the database connection object
  26. #
  27. $Conn = $Server->CreateObject("ADODB.Connection");
  28. # Open a system DSN
  29. #
  30. $Conn->Open( "ADOSamples" );
  31. # Execute an SQL query to retrieve all data from the table
  32. # Orders
  33. #
  34. $RS = $Conn->Execute( "SELECT * FROM Orders" );%>
  35. <P>
  36. <TABLE BORDER=1>
  37. <TR>
  38. <%
  39. # This lets you know how many columns there are for each
  40. # record that was retrieved
  41. #
  42. $count = $RS->Fields->{Count};
  43. # Print out the names of these columns
  44. #
  45. for ( $i = 0; $i < $count; $i++ ) {
  46. %>
  47. <TD>
  48. <B>
  49. <%= $RS->Fields($i)->{Name} %>
  50. </B>
  51. </TD>
  52. <%
  53. };
  54. %>
  55. </TR>
  56. <%
  57. # EOF is a property which signals that the last
  58. # record in the recordset returned from the SQL
  59. # query has been passed
  60. #
  61. while ( ! $RS->{EOF} ) {
  62. %> <TR> <%
  63. # Print every value per column
  64. #
  65. for ( $i = 0; $i < $count; $i++ ) {
  66. %><TD VALIGN=TOP>
  67. <%= $RS->Fields($i)->{Value} %></TD><%
  68. };
  69. %> </TR> <%
  70. # Move to the next record in the set
  71. #
  72. $RS->MoveNext;
  73. };
  74. # Close the Recordset
  75. #
  76. $RS->Close;
  77. # Close the Connection
  78. #
  79. $Conn->Close;
  80. %>
  81. </TABLE>
  82. <!-- +++++++++++++++++++++++++++++++++++++
  83. here is the standard showsource link -
  84. Note that PerlScript must be the default language --> <hr>
  85. <%
  86. $url = $Request->ServerVariables('PATH_INFO')->item;
  87. $_ = $Request->ServerVariables('PATH_TRANSLATED')->item;
  88. s/[\/\\](\w*\.asp\Z)//m;
  89. $params = 'filename='."$1".'&URL='."$url";
  90. $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  91. %>
  92. <A HREF="index.htm"> Return </A>
  93. <A HREF="showsource.asp?<%=$params%>">
  94. <h4><i>view the source</i></h4></A>
  95. </BODY>
  96. </HTML>