<% 'save as 2showtablenames.asp %>
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Getting Table Names</title>
<link rel="stylesheet" type="text/css" href="../index.css">
</head><body style="font-family: Verdana; font-size: 10pt">
<p>
<b><font face="Webdings" color="#FF0000">3</font></b><i><font size="1"><a href="http://www.classicaspreference.com/aspexamples/menu.htm">Back
to ASP Examples
Menu</a></font><br>
</i>
<b><font face="Webdings" color="#FF0000">3</font><font size="1"><i><a target="_blank" href="select_database.asp">Back
to Database Selection</a></i></font></b><br>
<b><font face="Webdings" color="#FF0000">3</font></b><i><font size="1"><a href="default.asp">Back to Database Interface Wizard Home Page</a></font><br>
</i>
<b><font face="Webdings" color="#FF0000">4</font><i><font size="1"><a title="Please let me know if this has been helpful." href="mailto:lilpeck@gmail.com?subject=database interface generation wizard">This
script cobbled together by Lil Peck</a></font></i></b></p>
<p>From
<a target="_blank" href="http://www.4guysfromrolla.com/webtech/013101-1.2.shtml">
&quot;Working With Adox Part 2&quot;</a> at 4 Guys From Rolla</p>
<%
dim strDB
strDB = request.form("dbname")
%>
<p><b><font size="5">Getting table names for database <u><%=strDB %></u>.</font><br>
</b> &nbsp;<br>
<b>Checkmark the fields that you want to use. Scroll down to view each form. Each form will open a new window
for its respective output.</b><br>
<font size="4">
<b><%
dim myTable
myTable = request.form("Table")
response.write "<b>My Table: " & myTable
%></b>
&nbsp;</font></b></p><b><font size="4">Form for Display Script Output:</font></b><font size="4">
</font>


<%

Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")

objADOXDatabase.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDB) & ";"
%>
<form target="_blank" method="POST" action="create_list_view.asp">
<input type="hidden" name="dbname" value="<%=strDB %>">
<input type="hidden" name="Table" value="<%=myTable %>">
<font size="2"><b>Select Fields to Display:</b>
<table>
<%


For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = myTable then


For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=""2"">" & "Primary key? <input type=""checkbox"" name=""key"" value="& objColumn.Name &">" & objColumn.Name & " </td></tr> "
Response.Write "Display Field: <input type=""checkbox"" name="&"F"&objColumn.Name&" value=""ON"">" & objColumn.Name & ""

Next

Response.Write "<br><br><b>Check 1 box below that is PRIMARY KEY:</b></td></tr>"
End If
end if
Next
%>
</td></tr></font><tr><td><input type="submit" value="Submit"></td></tr></table>
</form>


<hr>
<b><font size="4">Form for Add Script Output:</font>
</b>
<form target="_blank" method="POST" action="record_insertion_form.asp">

<input type="hidden" name="dbname" value="<%=strDB %>">
<input type="hidden" name="Table" value="<%=myTable %>">
<font size="2"><b>Select Fields to Display:</b>
<table>
<%


For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = myTable then


For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=""2"">" & "Primary key? <input type=""checkbox"" name=""key"" value="& objColumn.Name &">" & objColumn.Name & " </td></tr> "
Response.Write "Display Field: <input type=""checkbox"" name="&"F"&objColumn.Name&" value=""ON"">" & objColumn.Name & ""

Next

Response.Write "<br><br><b>Check 1 box below that is PRIMARY KEY:</b></td></tr>"
End If
end if
Next
%>
</td></tr></font><tr><td><input type="submit" value="Submit"></td></tr></table>
</form>
<hr>
<b><font size="4">Form for Edit Script Output:</font>
</b>
<form target="_blank" method="POST" action="editarecord.asp">

<input type="hidden" name="dbname" value="<%=strDB %>">
<input type="hidden" name="Table" value="<%=myTable %>">
<font size="2"><b>Select Fields to Display:</b>
<table>
<%


For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = myTable then


For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=""2"">" & "Primary key? <input type=""checkbox"" name=""key"" value="& objColumn.Name &">" & objColumn.Name & " </td></tr> "
Response.Write "Display Field: <input type=""checkbox"" name="&"F"&objColumn.Name&" value=""ON"">" & objColumn.Name & ""

Next

Response.Write "<br><br><b>Check 1 box below that is PRIMARY KEY:</b></td></tr>"
End If
end if
Next
%>
</td></tr></font><tr><td><input type="submit" value="Submit"></td></tr></table>
</form>
<hr>
<b><font size="4">Form for Delete Script Output:</font></b><font size="4">
</font><br>
<form target="_blank" method="POST" action="deletearecord.asp">
<input type="hidden" name="dbname" value="<%=strDB %>">
<input type="hidden" name="Table" value="<%=myTable %>">
<font size="2"><b>Select Fields to Display:</b>
<table>
<%


For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = myTable then


For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=""2"">" & "Primary key? <input type=""checkbox"" name=""key"" value="& objColumn.Name &">" & objColumn.Name & " </td></tr> "
Response.Write "Display Field: <input type=""checkbox"" name="&"F"&objColumn.Name&" value=""ON"">" & objColumn.Name & ""

Next

Response.Write "<br><br><b>Check 1 box below that is PRIMARY KEY:</b></td></tr>"
End If
end if
Next

%>
</td></tr></font><tr><td><input type="submit" value="Submit"></td></tr></table>
</form>
<hr>
<font size="4">
<b>Form for Upload Script Output:<br>
</b></font><font size="2">File to folder and filename and data to database</font><br>
<form target="_blank" method="POST" action="get_upload_form_variables.asp"><br>
<b>Type in the name of your File Categories Table if you have one:</b> <i>
(Not the same as your Files Table.)</i><br>

<%

For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
Response.Write "<b><input type=checkbox name=CatTable value="& objTable.Name &">" & objTable.Name & "</b><br>"

End If
Next


%>



<br>
<input type="hidden" name="dbname" value="<%=strDB %>">
<input type="hidden" name="Table" value="<%=myTable %>">
<font size="2"><b>Select Fields:</b> You must have a field for filename and for
file table primary key<table>
<%


For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = myTable then


For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=""2"">" & "Primary key? <input type=""checkbox"" name=""key"" value="& objColumn.Name &">" & objColumn.Name & " </td></tr> "
Response.Write "Display Field: <input type=""checkbox"" name="&""&objColumn.Name&" value="& objColumn.Name &">" & objColumn.Name & ""

Next

Response.Write "<br><br><b>Check 1 box below that is PRIMARY KEY:</b></td></tr>"
End If
end if
Next
Set objADOXDatabase = Nothing
%>
</td></tr></font><tr><td><input type="submit" value="Submit"></td></tr></table>
</form>

</body>

</html>