<% Response.Buffer=True %>
<%
'database startup code
dim RS 'recordset object
Set RS = Server.CreateObject("ADODB.Recordset")
'data source strings for drop down list
dim dsnarray(2)
dsnarray(0) = "MP3"
dsnarray(1) = "Protfolio"
dsnarray(2) = "ProductsDB"
'retrieve the form values
sql = Request.Form("sql") 'the SQL statement
clp = Request.Form("clp") 'the clipboard
dsn = Request.Form("dsn") 'the data source string
%>
SQL Test
<% Response.Flush 'for long winded queries, this will write out the response buffers %>
<%
if sql <> "" then ' execute the SQL if it's not empty
RS.Open sql, dsn
Response.Write("")
if RS.State = 1 then 'if the recordset has rows
'show the column names
Response.Write("")
for each f in RS.Fields
Response.Write("" & f.Name & " ")
next
Response.Write(" ")
'show the rows
do while not RS.EOF
Response.Write("")
for each f in RS.Fields
Response.Write("" & f.Value & " ")
next
Response.Write(" ")
RS.MoveNext
loop
else
'DML was performed
Response.Write("Command Completed Successfully ")
end if
Response.Write("
")
end if
%>
<% 'database clean up code
Set RS = Nothing
%>