From: <>

To: <>
Subject: Active Server Developer Tips, 01/19/2000
Date: Tue, 18 Jan 2000 13:18:11 -0400

Use ASP's ADOX to determine if internal database objects exist

Soon after ADO's release, Microsoft created an extension to the
object library called ActiveX Data Objects Extensions, or ADOX.
This library includes most of the DAO features missing from
standard ADO, including objects related to a database's schema.
With ADOX you can easily determine if a database contains a
specific table, view, or query.

For schema purposes, the ADOX consists of a Catalog object,
which contains the object collections that describe the database,
tables and views among them. To test for an existing table in the
Tables collection, you can either iterate through the collection
and check each item's name against the test string; or you can use
our favorite method, as seen in the following code:

Dim cat
Dim tbl
Dim con
Set con = Server.CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" &
Set cat = server.createobject("ADOX.Catalog")
Set cat.ActiveConnection = con
On Error Resume Next
Set tbl = cat.Tables("tblAuthors")

If tbl Is Nothing Then
response.write("MyTable doesn't exist")
response.write("MyTable exists")
Set tbl = Nothing
End If
Set cat = Nothing
Set con = Nothing