How can I find tables within a database??

Results 1 to 2 of 2

Thread: How can I find tables within a database??

  1. #1
    Join Date
    Dec 1969

    Default How can I find tables within a database??

    I&#039ve got a database with ODBC-name: Database (how original..)<BR>In this database are 3 tables:<BR> Friends_tbl<BR> Family_tbl<BR> Pets_tbl<BR><BR>Is there a way I can search through the database, and get the 3 names of the tables back? So no search within a table, but a search in the database alone.. What is the execution-command?<BR><BR>If anyone knows the answer to this one... PLEASE!

  2. #2
    Joel Nelson Guest

    Default RE: How can I find tables within a database??

    Here is ASP/VBScript code that will do what I think you want. You&#039ll need to change the connection string to reflect your DSN.<BR><BR>&#060;!-- #include virtual="/" --&#062;<BR>&#060;%<BR>&#039 This uses the OLEDB provider for Jet Databases. Your<BR>&#039 connection string<BR>&#039 could also use the OLEDB provider for ODBC to connect to your<BR>&#039 DSN.<BR>&#039 Also, the constant adSchemaTables is in the include file or you<BR>&#039 can use the actual integer value (20) although that is less<BR>&#039 desireable.<BR><BR>Dim oConn, oRecSet, strConnect<BR>set oConn = Server.CreateObject("ADODB.Connection")<BR>set oRecSet = Server.CreateObject("ADODB.Connection")<BR>strConn ect = "Provider=Microsoft.Jet.OLEDB.4.0.0;Data" _<BR> & " Source=d:inetpubwwwrootpubs.mdb"<BR><BR>oConn.Open strConnect<BR><BR>Set oRecSet = oConn.OpenSchema(adSchemaTables)<BR><BR>While Not oRecSet.EOF<BR> Response.write oRecSet("TABLE_NAME") & "<BR>" & vbCrLf<BR> oRecSet.MoveNext<BR>Wend<BR><BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts