<%@ LANGUAGE = PerlScript%> ActiveX Database Objects
ActiveState PerlScript


ActiveX Data Objects (ADO)

<% # Create the database connection object # $Conn = $Server->CreateObject("ADODB.Connection"); # Open a system DSN # $Conn->Open( "ADOSamples" ); # Execute an SQL query to retrieve all data from the table # Orders # $RS = $Conn->Execute( "SELECT * FROM Orders" );%>

<% # This lets you know how many columns there are for each # record that was retrieved # $count = $RS->Fields->{Count}; # Print out the names of these columns # for ( $i = 0; $i < $count; $i++ ) { %> <% }; %> <% # EOF is a property which signals that the last # record in the recordset returned from the SQL # query has been passed # while ( ! $RS->{EOF} ) { %> <% # Print every value per column # for ( $i = 0; $i < $count; $i++ ) { %><% }; %> <% # Move to the next record in the set # $RS->MoveNext; }; # Close the Recordset # $RS->Close; # Close the Connection # $Conn->Close; %>
<%= $RS->Fields($i)->{Name} %>
<%= $RS->Fields($i)->{Value} %>


<% $url = $Request->ServerVariables('PATH_INFO')->item; $_ = $Request->ServerVariables('PATH_TRANSLATED')->item; s/[\/\\](\w*\.asp\Z)//m; $params = 'filename='."$1".'&URL='."$url"; $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg; %> Return

view the source