LISTING 2: Code that Connects to Database and Executes Query Sub Main() Dim strConnectString, strCurrentTableName, strQuery Dim oConn Dim oRsTableList '--- Retrieve the connection string from Querystring. strConnectString = Request.QueryString("strConnectString") If IsEmpty(strConnectString) Then strConnectString = "Driver={SQL Server}; Server=(local);” + _ “Database=PUBS; UID=sa; PWD=" End If '--- Create the connection object. Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open strConnectString '--- Get the list of tables within the database. strQuery = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE “ + _ “ TABLE_TYPE='BASE TABLE'" Set oRsTableList = oConn.Execute(strQuery) '--- Loop within the list of tables. While (Not oRsTableList.EOF) '--- Get the table name. strCurrentTableName = oRsTableList("TABLE_NAME") '--- Render the table fields. RenderTableAttributes strCurrentTableName, oConn '--- Render the table constraints. RenderTableConstraints strCurrentTableName, oConn '--- Next table. oRsTableList.MoveNext Wend Set oConn = Nothing End Sub