discourse-legacysite-perl/site/slowtwitch.com/www/secure/database/TableList.asp
2024-06-17 22:30:36 +10:00

95 lines
2.6 KiB
Plaintext

<%@ LANGUAGE="vbscript" %>
<%Option Explicit%>
<%
'-------------------------------------------------------------------------------
'Aawsom Technologies
'Created By: Steve Hunsader
'Created On: 2/8/02
'-------------------------------------------------------------------------------
'Defining Objects
Dim sTableName
Dim Products, rsProducts 'These should be renamed for each project
Dim sQuery, cmdTemp, nFields, ThisRecord, i
'insert table name
sTableName = "Products"
'If a Query String item "T" exists, then display that table instead.
If trim(Request.QueryString("T")) <> "" then
sTableName = trim(Request.QueryString("T"))
End If
sQuery = "SELECT * FROM " & sTableName
'Connection Object to database
Set Products=Server.CreateObject("ADODB.Connection")
Products.ConnectionTimeout = Session("ConnectionTimeout")
Products.CommandTimeout = Session("CommandTimeout")
Products.Open Session("ConnectString"), Session("RuntimeUser"), Session("RuntimePass")
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set rsProducts = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = sQuery
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = Products
rsProducts.Open cmdTemp, , 0, 1
'Response.Write sQuery
%>
<html>
<head>
<title>Table <%=sTableName%></title>
</head>
<body>
<div align="left">
<table border="0" cellpadding="6" align="center" width="90%">
<tr>
<td>
</td>
</tr>
<tr>
<td>
<div align="center">
<table border="0" cellspacing="4" cellpadding="5" width="90%">
<tr>
<td>
<div align="center"><font size="3"><b>Table <%=sTableName%></b></font></div>
</td>
</tr>
</table>
<br>
<table border=0 align="center" cellpadding="0" cellspacing="5" width="50%">
<tr>
<%'Header On The Table of Field Names%>
<%nFields=rsProducts.fields.count -1%>
<%For i=0 to nFields%>
<td><b><%=rsProducts(i).name%></b></td>
<%Next%>
</tr>
<%' Loop through the records%>
<%Do While NOT rsProducts.EOF%>
<tr>
<%For i = 0 to nFields
ThisRecord = rsProducts(i)
If IsNull(ThisRecord) Then
ThisRecord = "&nbsp;"
End If%>
<td valign=top>
<div align="left"><%=ThisRecord%></div>
</td>
<%Next%>
</tr>
<%rsProducts.movenext%>
<%Loop%>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>