Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Names of Tables for ListBox

Names of Tables for ListBox

Scheduled Pinned Locked Moved C#
databasetutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blekk
    wrote on last edited by
    #1

    Hi, I am creating a database, and on the first form I want a listbox displaying the names of all the tables, so when a user clicks on one and clicks the OK button, it will open another form showing the data in that table. What I need to know is how to get the names of the tables in the database without hard coding it. Thanks in advance, Any reply is appreciated.

    R N 2 Replies Last reply
    0
    • B Blekk

      Hi, I am creating a database, and on the first form I want a listbox displaying the names of all the tables, so when a user clicks on one and clicks the OK button, it will open another form showing the data in that table. What I need to know is how to get the names of the tables in the database without hard coding it. Thanks in advance, Any reply is appreciated.

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      Hi, have a look at the GetSchema[^] on your connection class. I think it doesn't work on every database and it's also not very comfortable to get the results out of the returned DataTable but it worked for me when wokring with Access databases. Robert

      1 Reply Last reply
      0
      • B Blekk

        Hi, I am creating a database, and on the first form I want a listbox displaying the names of all the tables, so when a user clicks on one and clicks the OK button, it will open another form showing the data in that table. What I need to know is how to get the names of the tables in the database without hard coding it. Thanks in advance, Any reply is appreciated.

        N Offline
        N Offline
        Noman Nadeem
        wrote on last edited by
        #3

        Well, it would help if you mentioned which database you are working with. I can help you with oracle: for all tables: 'select table_name from dba_tables;' for tables for a specific owner: 'select table_name from dba_tables where owner = 'XYZ';' for all the tables you have access to: 'select table_name from all_tables'; based on the result you may fill the listbox ! hope this helps

        regards, Noman Nadeem :zzz:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups