home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / win95 / plsei306.exe / aspSamples / ado1.asp next >
Text File  |  1997-03-22  |  2KB  |  86 lines

  1. <%@ LANGUAGE = PerlScript%>
  2. <html>
  3. <head>
  4. <meta name="GENERATOR" content="ActiveWare_Hack = Dick Hardt">
  5. <!-- 
  6.     Copyright (c) 1996, Microsoft Corporation.  All rights reserved.
  7.     Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
  8. -->
  9. <title>Active X Database Object</title>
  10. </head>
  11. <body>
  12. <BODY BGCOLOR=#FFFFFF>
  13.  
  14. <!-- 
  15.     ActiveWare PerlScript sample 
  16.     PerlScript:  The coolest way to program custom web solutions. 
  17. -->
  18.  
  19. <!-- Masthead -->
  20. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  21. <TR VALIGN=TOP ><TD WIDTH=400>
  22. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveWare PerlScript" BORDER=0></A><P>
  23. </TD></TR></TABLE>
  24.  
  25. <HR>
  26.  
  27. <H3>ActiveX Data Object (ADO)</H3>
  28.  
  29. <!-- 
  30. <%
  31.     $ErrorNum = $!;
  32.     $ErrorStr = 'Err:'.$!;
  33.     if ($Conn eq undef) {
  34.         $val = 'undef';
  35.     } else {
  36.         $val = $Conn;
  37.     }
  38.     %>
  39.     $Conn =    <%= $val %> <br>
  40.     $ErrorNum =    <%= $ErrorNum %> <br>
  41.     $ErrorStr =    <%= $ErrorStr %> <br>
  42. -->
  43.     <%
  44.     $Conn = $Server->CreateObject("ADODB.Connection");
  45.     $Conn->Open( "ADOSamples" );
  46.     $RS = $Conn->Execute( "SELECT * FROM Orders" );%>
  47.  
  48.     <P>
  49.     <TABLE BORDER=1>
  50.     <TR>
  51.     <%
  52.     $count = $RS->Fields->Count;
  53.     for ( $i = 0; $i < $count; $i++ ) {
  54.         %><TD><B><%= $RS->Fields($i)->Name %></B></TD><%
  55.     }; %> </TR> <%
  56.     while ( ! $RS->EOF ) {
  57.         %> <TR> <%
  58.         for ( $i = 0; $i < $count; $i++ ) {
  59.             %><TD VALIGN=TOP>
  60.             <%= $RS->Fields($i)->value %></TD><%
  61.         };
  62.         %> </TR> <%
  63.         $RS->MoveNext;
  64.     };
  65.     $RS->Close;
  66.     $Conn->Close;
  67.     %>
  68. </TABLE>
  69.  
  70. <!-- +++++++++++++++++++++++++++++++++++++
  71. here is the standard showsource link - 
  72.     Note that PerlScript must be the default language --> <hr>
  73. <%
  74.     $url = $Request->ServerVariables('PATH_INFO')->item;
  75.     $_ = $Request->ServerVariables('PATH_TRANSLATED')->item;
  76.     s/[\/\\](\w*\.asp\Z)//m;
  77.     $params = 'filename='."$1".'&URL='."$url";
  78.     $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  79. %>
  80. <A HREF="index.htm"> Return </A>
  81. <A HREF="showsource.asp?<%=$params%>">
  82. <h4><i>view the source</i></h4></A>  
  83.  
  84. </BODY>
  85. </HTML>
  86.