Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return a list of database tables

Status
Not open for further replies.

estafford

Programmer
Sep 5, 2002
22
0
0
US
Greetings,

I got the SQL for returning a list of tables in an access 2000 database from another forum, But I am unsure of how to execute it in an ASP page.

The SQL is:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],4) <> &quot;Msys&quot;) AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name

Do I execute this by creating a Recordset?
Server.CreateObject(&quot;ADODB.Recordset&quot;)

Command?
Server.CreateObject(&quot;ADODB.Command&quot;);

or What?

Thank You for any help
 
You need it in a recordset really so you can interrogate it in asp and write data to the screen etc.

Andy

some example code, sorry not syntax checked
<%
dim objconn,objrs
set objconn = server.createobject(&quot;adodb.connection&quot;)
set objrs = server.createobject(&quot;adodb.recordset&quot;)
objconn.open &quot;Provider = Microsoft.Jet.oledb.4.0;Data Source = c:\??\???.mdb;Persist security info=false&quot;

objrs.open &quot;SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],4) <> &quot;Msys&quot;) AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name&quot;,objconn


objrs.close
objconn.close
set objrs=nothing
set objconn = nothing

%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top