Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Showing DB Tables and Their Contents

    Hey,

    Is there an easy way to get and show all the contents of a database's tables?

    What I've got is a new db structure that has about a hundred tables in it and what I want to do is have a page that shows just the table names and when the name is clicked on it will show the contents of that particular table. I can show the contents just fine I learned that from w3schools. I just need to know how to show the names of the tables first and have them linked to the page that shows the data.

    Thanks,
    Larry

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    If you're using MS-SQL, there is a table called sysobjects in every database, you can search this table for all tablenames in the database.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    actually it's a MS Access DB

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Anybody?

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    set rs = conn.Execute("SELECT * FROM testTable")
    For Each fld In rs.Fields
    response.write fld.Name
    response.write " = "
    response.write fld.Value
    response.write "<br />"
    rs.MoveNext
    Next
    rs.Close

    Something like that should work...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, that shows the fields within a specified table, but I'm trying to show a list of all the tables that are contained within the database, mostly.

    Any Ideas?

    Cheers,
    Larry

    P.S. Hey, Whammy, where's Dave at he usually has good input on things like this?


  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oops, I read that wrong! Sorry about that. Never tried to get all the table names.... hmm I'll have to research that one a bit...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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