[thelist] sql? List Tables

Joel Morris joelm at citycent.com
Thu Oct 5 20:00:38 CDT 2000

You can get data on a remote database (Access or SQL) with Schema.

1. Include the adovbs.inc file.
2. Open your connection.
3. Here are some code snippets: (check the Wrox "Beginning Databases" book
for more info)

<h3>Table Names</h3>
Set objRS = oConn.OpenSchema(adSchemaTables)
While Not objRS.EOF
	Response.Write objRS("Table_Name") & "<br>"
Set objRs = Nothing

<!-- Field Names -->
<h3>Field Names</h3>
Set objRs=oConn.OpenSchema(adSchemaColumns)

Response.Write "<table border='1' width='90%'>"
Response.Write "<th>Table Source</th><th>Column Name</th><th>Max Width</th>"

While Not objRS.EOF
	Response.Write "<tr><td>" & objRS("Table_Name") & "&nbsp;</td>"
	Response.Write "<td>" & objRS("Column_Name") & "&nbsp;</td>"
	Response.Write "<td>" & objRS("Character_Maximum_Length") &

Response.Write "</table>"
Set objRS=Nothing
<!-- General Database Info -->

<h3>Database Info</h3>
<table border="1" width="90%">
<td width="10%">Number</td>
<td width="20%">Value</td></tr>

For Each item in oConn.Properties
	i = i+1
	Response.Write "<tr><td>" & i & "</td>"
	Response.Write "<td>" & item.name & "</td>"
	Response.Write "<td>" & item.value & "</td></tr>"
Set oConn = Nothing

Joel Morris
CityCenter Co.
Web Development & Marketing
mailto:joelm at citycent.com

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Tab Alleman
> Sent: Thursday, October 05, 2000 7:48 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] sql? List Tables
> How can I get a list of the tables in a given Access Database with an ASP
> script?  Can it be done?  Seems like it should be possible, but I
> can't find
> it anywhere.

More information about the thelist mailing list